@@ -0,0 +1,1259 @@
+diff -uNr ffmpeg.orig/configure ffmpeg/configure
+--- ffmpeg.orig/configure 2007-12-25 11:42:45.000000000 +0100
++++ ffmpeg/configure 2007-12-26 19:55:57.000000000 +0100
+@@ -88,6 +88,7 @@
+ echo " --enable-libfaac enable FAAC support via libfaac [default=no]"
+ echo " --enable-libfaad enable FAAD support via libfaad [default=no]"
+ echo " --enable-libfaadbin open libfaad.so.0 at runtime [default=no]"
++ echo " --enable-libg729a enable G.729A support via libg729a [default=no]"
+ echo " --enable-libgsm enable GSM support via libgsm [default=no]"
+ echo " --enable-libmp3lame enable MP3 encoding via libmp3lame [default=no]"
+ echo " --enable-libnut enable NUT (de)muxing via libnut,"
+@@ -622,6 +623,7 @@
+ libfaac
+ libfaad
+ libfaadbin
++ libg729a
+ libgsm
+ libmp3lame
+ libnut
+@@ -781,6 +783,8 @@
+ libfaac_encoder_deps="libfaac"
+ libfaad_decoder_deps="libfaad"
+ libfaadbin_decoder_extralibs='$ldl'
++g729a_decoder_deps="libg729a"
++g729a_encoder_deps="libg729a"
+ libgsm_decoder_deps="libgsm"
+ libgsm_encoder_deps="libgsm"
+ libgsm_ms_decoder_deps="libgsm"
+@@ -794,6 +798,8 @@
+
+ # demuxers / muxers
+ ac3_demuxer_deps="ac3_parser"
++act_muxer_deps="g729a_encoder"
++act_demuxer_deps="g729a_decoder"
+ audio_beos_demuxer_deps="audio_beos"
+ audio_beos_demuxer_extralibs="-lmedia -lbe"
+ audio_beos_muxer_deps="audio_beos"
+@@ -1608,6 +1614,7 @@
+ enabled libdc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
+ enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
+ enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
++enabled libg729a && require libg729a g729a.h g729a_encoder_init -lg729a
+ enabled libgsm && require libgsm gsm.h gsm_create -lgsm
+ enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
+ enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
+@@ -1868,6 +1875,7 @@
+ echo "libfaac enabled ${libfaac-no}"
+ echo "libfaad enabled ${libfaad-no}"
+ echo "libfaad dlopened ${libfaadbin-no}"
++echo "libg729a enabled ${libg729a-no}"
+ echo "libgsm enabled ${libgsm-no}"
+ echo "libmp3lame enabled ${libmp3lame-no}"
+ echo "libnut enabled ${libnut-no}"
+diff -uNr ffmpeg.orig/libavcodec/adpcm.c ffmpeg/libavcodec/adpcm.c
+--- ffmpeg.orig/libavcodec/adpcm.c 2007-11-06 22:51:04.000000000 +0100
++++ ffmpeg/libavcodec/adpcm.c 2007-12-26 20:04:43.000000000 +0100
+@@ -149,6 +149,8 @@
+ typedef struct ADPCMContext {
+ int channel; /* for stereo MOVs, decode left, then decode right, then tell it's decoded */
+ ADPCMChannelStatus status[6];
++ int extra_amv_samples; //number of samples to put into next frame
++ int samples_written;
+ } ADPCMContext;
+
+ /* XXX: implement encoding */
+@@ -183,6 +185,16 @@
+ }
+ avctx->frame_size = 512 * (avctx->sample_rate / 11025);
+ break;
++ case CODEC_ID_ADPCM_IMA_AMV:
++ if (avctx->channels != 1){
++ av_log(avctx, AV_LOG_ERROR, "Only mono sound is supported\n");
++ return -1;
++ }
++ if (avctx->sample_rate != 22050){
++ av_log(avctx, AV_LOG_ERROR, "Only 22050 sample rate is supported\n");
++ return -1;
++ }
++ break;
+ default:
+ return -1;
+ break;
+@@ -295,7 +307,7 @@
+ nodes[0]->step = c->step_index;
+ nodes[0]->sample1 = c->sample1;
+ nodes[0]->sample2 = c->sample2;
+- if((version == CODEC_ID_ADPCM_IMA_WAV) || (version == CODEC_ID_ADPCM_SWF))
++ if((version == CODEC_ID_ADPCM_IMA_WAV) || (version == CODEC_ID_ADPCM_SWF) || (version == CODEC_ID_ADPCM_IMA_AMV))
+ nodes[0]->sample1 = c->prev_sample;
+ if(version == CODEC_ID_ADPCM_MS)
+ nodes[0]->step = c->idelta;
+@@ -366,7 +378,7 @@
+ next_##NAME:;
+ STORE_NODE(ms, FFMAX(16, (AdaptationTable[nibble] * step) >> 8));
+ }
+- } else if((version == CODEC_ID_ADPCM_IMA_WAV)|| (version == CODEC_ID_ADPCM_SWF)) {
++ } else if((version == CODEC_ID_ADPCM_IMA_WAV)|| (version == CODEC_ID_ADPCM_SWF)|| (version == CODEC_ID_ADPCM_IMA_AMV)) {
+ #define LOOP_NODES(NAME, STEP_TABLE, STEP_INDEX)\
+ const int predictor = nodes[j]->sample1;\
+ const int div = (sample - predictor) * 4 / STEP_TABLE;\
+@@ -1585,7 +1597,7 @@
+ ADPCM_DECODER(CODEC_ID_ADPCM_EA_R2, adpcm_ea_r2);
+ ADPCM_DECODER(CODEC_ID_ADPCM_EA_R3, adpcm_ea_r3);
+ ADPCM_DECODER(CODEC_ID_ADPCM_EA_XAS, adpcm_ea_xas);
+-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv);
++ADPCM_CODEC (CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv);
+ ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3);
+ ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
+ ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
+diff -uNr ffmpeg.orig/libavcodec/allcodecs.c ffmpeg/libavcodec/allcodecs.c
+--- ffmpeg.orig/libavcodec/allcodecs.c 2007-12-20 10:57:16.000000000 +0100
++++ ffmpeg/libavcodec/allcodecs.c 2007-12-26 19:55:58.000000000 +0100
+@@ -61,7 +61,7 @@
+
+ /* video codecs */
+ REGISTER_DECODER (AASC, aasc);
+- REGISTER_DECODER (AMV, amv);
++ REGISTER_ENCDEC (AMV, amv);
+ REGISTER_ENCDEC (ASV1, asv1);
+ REGISTER_ENCDEC (ASV2, asv2);
+ REGISTER_DECODER (AVS, avs);
+@@ -179,6 +179,7 @@
+ REGISTER_DECODER (DCA, dca);
+ REGISTER_DECODER (DSICINAUDIO, dsicinaudio);
+ REGISTER_ENCDEC (FLAC, flac);
++ REGISTER_ENCDEC (G729A, g729a);
+ REGISTER_DECODER (IMC, imc);
+ REGISTER_DECODER (MACE3, mace3);
+ REGISTER_DECODER (MACE6, mace6);
+@@ -242,7 +243,7 @@
+ REGISTER_DECODER (ADPCM_EA_R3, adpcm_ea_r3);
+ REGISTER_DECODER (ADPCM_EA_XAS, adpcm_ea_xas);
+ REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
+- REGISTER_DECODER (ADPCM_IMA_AMV, adpcm_ima_amv);
++ REGISTER_ENCDEC (ADPCM_IMA_AMV, adpcm_ima_amv);
+ REGISTER_DECODER (ADPCM_IMA_DK3, adpcm_ima_dk3);
+ REGISTER_DECODER (ADPCM_IMA_DK4, adpcm_ima_dk4);
+ REGISTER_DECODER (ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
+diff -uNr ffmpeg.orig/libavcodec/avcodec.h ffmpeg/libavcodec/avcodec.h
+--- ffmpeg.orig/libavcodec/avcodec.h 2007-12-21 17:43:20.000000000 +0100
++++ ffmpeg/libavcodec/avcodec.h 2007-12-26 19:55:58.000000000 +0100
+@@ -274,6 +274,7 @@
+ CODEC_ID_APE,
+ CODEC_ID_NELLYMOSER,
+ CODEC_ID_MUSEPACK8,
++ CODEC_ID_G729A,
+
+ /* subtitle codecs */
+ CODEC_ID_DVD_SUBTITLE= 0x17000,
+diff -uNr ffmpeg.orig/libavcodec/g729dec.c ffmpeg/libavcodec/g729dec.c
+--- ffmpeg.orig/libavcodec/g729dec.c 1970-01-01 01:00:00.000000000 +0100
++++ ffmpeg/libavcodec/g729dec.c 2007-12-26 19:55:58.000000000 +0100
+@@ -0,0 +1,209 @@
++/*
++ * G.729 Annex A codec wrapper (around reference ITU's source)
++ * Copyright (c) 2007 Vladimir Voroshilov
++ *
++ * 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 "bitstream.h"
++
++#include <g729a.h>
++
++typedef struct
++{
++ unsigned char format;
++#ifdef DEBUG_DUMP
++ FILE* f;
++ FILE* f2;
++#endif
++ void* priv;
++} G729Context;
++
++#define MAX_FORMATS 2
++
++#define MP1 11
++
++
++#ifdef G729_UNPACKED_LSP
++#define VECTOR_SIZE 15
++#define DEF_VECTOR(L0,L1,L2,L3,P1,P0,C1,S1,GA1,GB1,P2,C2,S2,GA2,GB2) {L0,L1,L2,L3,P1,P0,C1,S1,GA1,GB1,P2,C2,S2,GA2,GB2}
++#else
|