summaryrefslogtreecommitdiff
path: root/media-video/ffmpeg/files
diff options
context:
space:
mode:
author(no author) <(no author)@4d9a9b59-111c-4e0b-8f7a-7640551abb98>2009-03-16 07:55:01 +0000
committer(no author) <(no author)@4d9a9b59-111c-4e0b-8f7a-7640551abb98>2009-03-16 07:55:01 +0000
commitf1e95daae05c57d935b00e611c624c5e75cd21ec (patch)
tree4065ab51d9e64882d9001a59ede7d9a4e372a4a6 /media-video/ffmpeg/files
uploading my overlay ), initial commit
git-svn-id: http://172.18.13.13/svn/sss_overlay@1 4d9a9b59-111c-4e0b-8f7a-7640551abb98
Diffstat (limited to 'media-video/ffmpeg/files')
-rwxr-xr-xmedia-video/ffmpeg/files/cabac-asm.patch11
-rw-r--r--media-video/ffmpeg/files/disable-version-rebranding-2008.10.patch12
-rw-r--r--media-video/ffmpeg/files/disable-version-rebranding-2008.patch12
-rw-r--r--media-video/ffmpeg/files/disable-version-rebranding-2009.01.patch12
-rwxr-xr-xmedia-video/ffmpeg/files/disable-version-rebranding.patch12
-rwxr-xr-xmedia-video/ffmpeg/files/ffmpeg-amr-64bit.patch27
-rw-r--r--media-video/ffmpeg/files/ffmpeg-asm-pic.patch35
-rw-r--r--media-video/ffmpeg/files/ffmpeg-eac3_decoder-20080817.patch506
-rw-r--r--media-video/ffmpeg/files/ffmpeg-icc.patch14
-rwxr-xr-xmedia-video/ffmpeg/files/ffmpeg-libdir-pic.patch169
-rwxr-xr-xmedia-video/ffmpeg/files/ffmpeg-libdir.patch11
-rwxr-xr-xmedia-video/ffmpeg/files/ffmpeg-shared-gcc4.1.patch40
-rwxr-xr-xmedia-video/ffmpeg/files/ffmpeg-soname-symlink.patch146
-rwxr-xr-xmedia-video/ffmpeg/files/ffmpeg-unknown-options.patch16
-rw-r--r--media-video/ffmpeg/files/ffmpeg-x86-pic-fix-20080916.patch11
-rw-r--r--media-video/ffmpeg/files/ffmpeg-x86-pic-fix.patch10
16 files changed, 1044 insertions, 0 deletions
diff --git a/media-video/ffmpeg/files/cabac-asm.patch b/media-video/ffmpeg/files/cabac-asm.patch
new file mode 100755
index 0000000..8bbf3a9
--- /dev/null
+++ b/media-video/ffmpeg/files/cabac-asm.patch
@@ -0,0 +1,11 @@
+--- libavcodec/cabac.h.orig 2006-11-19 15:38:01.000000000 +0000
++++ libavcodec/cabac.h 2006-11-19 15:48:57.000000000 +0000
+@@ -659,7 +659,7 @@
+
+ :"+c"(val)
+ :"r"(c)
+- : "%eax", "%"REG_b, "%edx", "memory"
++ : "%eax", "%edx", "memory"
+ );
+ return val;
+ #else
diff --git a/media-video/ffmpeg/files/disable-version-rebranding-2008.10.patch b/media-video/ffmpeg/files/disable-version-rebranding-2008.10.patch
new file mode 100644
index 0000000..ee7e948
--- /dev/null
+++ b/media-video/ffmpeg/files/disable-version-rebranding-2008.10.patch
@@ -0,0 +1,12 @@
+--- src/common.mak.orig 2008-06-22 00:25:48.000000000 +0200
++++ src/common.mak 2008-06-22 00:28:54.000000000 +0200
+@@ -45,9 +45,6 @@
+ $(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
+ endif
+
+-$(BUILD_ROOT_REL)/version.h:
+- $(SRC_PATH)/version.sh $(SRC_PATH) $@ $(EXTRA_VERSION)
+-
+ install: install-libs install-headers
+
+ uninstall: uninstall-libs uninstall-headers
diff --git a/media-video/ffmpeg/files/disable-version-rebranding-2008.patch b/media-video/ffmpeg/files/disable-version-rebranding-2008.patch
new file mode 100644
index 0000000..d3a9461
--- /dev/null
+++ b/media-video/ffmpeg/files/disable-version-rebranding-2008.patch
@@ -0,0 +1,12 @@
+--- src/common.mak.orig 2008-06-22 00:25:48.000000000 +0200
++++ src/common.mak 2008-06-22 00:28:54.000000000 +0200
+@@ -45,9 +45,6 @@
+ $(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
+ endif
+
+-$(BUILD_ROOT_REL)/version.h:
+- $(SRC_PATH)/version.sh $(SRC_PATH) $@
+-
+ install: install-libs install-headers
+
+ uninstall: uninstall-libs uninstall-headers
diff --git a/media-video/ffmpeg/files/disable-version-rebranding-2009.01.patch b/media-video/ffmpeg/files/disable-version-rebranding-2009.01.patch
new file mode 100644
index 0000000..9cd7366
--- /dev/null
+++ b/media-video/ffmpeg/files/disable-version-rebranding-2009.01.patch
@@ -0,0 +1,12 @@
+--- ffmpeg/common.mak.orig 2009-01-26 20:24:53.000000000 +0100
++++ ffmpeg/common.mak 2009-01-26 20:25:54.000000000 +0100
+@@ -48,9 +48,6 @@
+ $(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
+ endif
+
+-$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh
+- $< $(SRC_PATH) $@ $(EXTRA_VERSION)
+-
+ install: install-libs install-headers
+
+ uninstall: uninstall-libs uninstall-headers
diff --git a/media-video/ffmpeg/files/disable-version-rebranding.patch b/media-video/ffmpeg/files/disable-version-rebranding.patch
new file mode 100755
index 0000000..3763df5
--- /dev/null
+++ b/media-video/ffmpeg/files/disable-version-rebranding.patch
@@ -0,0 +1,12 @@
+--- Makefile.orig 2006-11-08 00:18:09.000000000 +0000
++++ Makefile 2006-11-08 00:19:46.000000000 +0000
+@@ -90,9 +90,6 @@
+ cp -p $< $@
+ $(STRIP) $@
+
+-version.h:
+- $(SRC_PATH)/version.sh $(SRC_PATH)
+-
+ output_example$(EXESUF): output_example.o .libs
+ $(CC) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
+
diff --git a/media-video/ffmpeg/files/ffmpeg-amr-64bit.patch b/media-video/ffmpeg/files/ffmpeg-amr-64bit.patch
new file mode 100755
index 0000000..540ef94
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-amr-64bit.patch
@@ -0,0 +1,27 @@
+diff --exclude-from=/home/dang/.diffrc -u -ruN ffmpeg-0.4.9-p20060302.orig/libavcodec/amr_float/typedef.h ffmpeg-0.4.9-p20060302/libavcodec/amr_float/typedef.h
+--- ffmpeg-0.4.9-p20060302.orig/libavcodec/amr_float/typedef.h 2003-03-26 14:15:42.000000000 -0500
++++ ffmpeg-0.4.9-p20060302/libavcodec/amr_float/typedef.h 2006-04-19 18:39:20.000000000 -0400
+@@ -16,7 +16,7 @@
+ typedef char Word8;
+ typedef unsigned char UWord8;
+ typedef short Word16;
+-typedef long Word32;
++typedef int Word32;
+ typedef float Float32;
+ typedef double Float64;
+
+diff --exclude-from=/home/dang/.diffrc -u -ruN ffmpeg-0.4.9-p20060302.orig/libavcodec/amrwb_float/typedef.h ffmpeg-0.4.9-p20060302/libavcodec/amrwb_float/typedef.h
+--- ffmpeg-0.4.9-p20060302.orig/libavcodec/amrwb_float/typedef.h 2003-02-18 00:00:02.000000000 -0500
++++ ffmpeg-0.4.9-p20060302/libavcodec/amrwb_float/typedef.h 2006-04-19 18:37:30.000000000 -0400
+@@ -11,8 +11,8 @@
+ typedef unsigned char UWord8;
+ typedef short Word16;
+ typedef unsigned short UWord16;
+-typedef long Word32;
++typedef int Word32;
+ typedef double Float64;
+ typedef float Float32;
+
+-#endif
+\ No newline at end of file
++#endif
diff --git a/media-video/ffmpeg/files/ffmpeg-asm-pic.patch b/media-video/ffmpeg/files/ffmpeg-asm-pic.patch
new file mode 100644
index 0000000..0cf16c3
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-asm-pic.patch
@@ -0,0 +1,35 @@
+Index: ffmpeg/libavcodec/cabac.h
+===================================================================
+--- ffmpeg.orig/libavcodec/cabac.h
++++ ffmpeg/libavcodec/cabac.h
+@@ -376,7 +376,7 @@ static int av_always_inline get_cabac_in
+ #define BYTE "16"
+ #define BYTEEND "20"
+ #endif
+-#if defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(CONFIG_EBX_AVAILABLE)
++#if defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(CONFIG_EBX_AVAILABLE) && !(defined(PIC) && defined(__GNUC__))
+ int bit;
+
+ #ifndef BRANCHLESS_CABAC_DECODER
+@@ -680,7 +680,7 @@ static av_always_inline int get_cabac_by
+
+ //FIXME the x86 code from this file should be moved into i386/h264 or cabac something.c/h (note ill kill you if you move my code away from under my fingers before iam finished with it!)
+ //FIXME use some macros to avoid duplicatin get_cabac (cant be done yet as that would make optimization work hard)
+-#if defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(CONFIG_EBX_AVAILABLE)
++#if defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(CONFIG_EBX_AVAILABLE) && !(defined(PIC) && defined(__GNUC__))
+ static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){
+ void *end= significant_coeff_ctx_base + max_coeff - 1;
+ int minusstart= -(int)significant_coeff_ctx_base;
+Index: ffmpeg/libavcodec/h264.c
+===================================================================
+--- ffmpeg.orig/libavcodec/h264.c
++++ ffmpeg/libavcodec/h264.c
+@@ -6111,7 +6111,7 @@ static int decode_cabac_residual( H264Co
+ index[coeff_count++] = last;\
+ }
+ const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
+-#if defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(CONFIG_EBX_AVAILABLE)
++#if defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(CONFIG_EBX_AVAILABLE) && !(defined(PIC) && defined(__GNUC__))
+ coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index, sig_off);
+ } else {
+ coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index);
diff --git a/media-video/ffmpeg/files/ffmpeg-eac3_decoder-20080817.patch b/media-video/ffmpeg/files/ffmpeg-eac3_decoder-20080817.patch
new file mode 100644
index 0000000..366414b
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-eac3_decoder-20080817.patch
@@ -0,0 +1,506 @@
+Index: libavcodec/ac3dec.c
+===================================================================
+--- libavcodec/ac3dec.c (revision 14819)
++++ libavcodec/ac3dec.c (working copy)
+@@ -1,8 +1,10 @@
+ /*
+ * AC-3 Audio Decoder
+- * This code is developed as part of Google Summer of Code 2006 Program.
++ * This code was developed as part of Google Summer of Code 2006.
++ * E-AC-3 support was added as part of Google Summer of Code 2007.
+ *
+ * Copyright (c) 2006 Kartikey Mahendra BHATT (bhattkm at gmail dot com).
++ * Copyright (c) 2007-2008 Bartlomiej Wolowiec <bartek.wolowiec@gmail.com>
+ * Copyright (c) 2007 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * Portions of this code are derived from liba52
+@@ -37,8 +39,8 @@
+ #include "ac3dec.h"
+ #include "ac3dec_data.h"
+
+-/** Maximum possible frame size when the specification limit is ignored */
+-#define AC3_MAX_FRAME_SIZE 21695
++/** Large enough for maximum possible frame size when the specification limit is ignored */
++#define AC3_FRAME_BUFFER_SIZE 32768
+
+ /**
+ * table for ungrouping 3 values in 7 bits.
+@@ -215,7 +217,7 @@
+
+ /* allocate context input buffer */
+ if (avctx->error_resilience >= FF_ER_CAREFUL) {
+- s->input_buffer = av_mallocz(AC3_MAX_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
++ s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!s->input_buffer)
+ return AVERROR_NOMEM;
+ }
+@@ -302,10 +304,22 @@
+ s->channel_in_cpl[s->lfe_ch] = 0;
+ }
+
+- if(hdr.bitstream_id > 10)
+- return AC3_PARSE_ERROR_BSID;
+-
++ if (hdr.bitstream_id <= 10) {
++ s->eac3 = 0;
++ s->snr_offset_strategy = 2;
++ s->block_switch_syntax = 1;
++ s->dither_flag_syntax = 1;
++ s->bit_allocation_syntax = 1;
++ s->fast_gain_syntax = 0;
++ s->first_cpl_leak = 0;
++ s->dba_syntax = 1;
++ s->skip_syntax = 1;
++ memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));
+ return ac3_parse_header(s);
++ } else {
++ s->eac3 = 1;
++ return ff_eac3_parse_header(s);
++ }
+ }
+
+ /**
+@@ -428,7 +442,7 @@
+ * Get the transform coefficients for a particular channel
+ * reference: Section 7.3 Quantization and Decoding of Mantissas
+ */
+-static void get_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, mant_groups *m)
++static void ac3_get_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, mant_groups *m)
+ {
+ GetBitContext *gbc = &s->gbc;
+ int i, gcode, tbap, start, end;
+@@ -533,10 +547,27 @@
+ }
+ }
+
++static void get_transform_coeffs_ch(AC3DecodeContext *s, int blk, int ch,
++ mant_groups *m)
++{
++ if (!s->channel_uses_aht[ch]) {
++ ac3_get_transform_coeffs_ch(s, ch, m);
++ } else {
++ /* if AHT is used, mantissas for all blocks are encoded in the first
++ block of the frame. */
++ int bin;
++ if (!blk)
++ ff_eac3_get_transform_coeffs_aht_ch(s, ch);
++ for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
++ s->fixed_coeffs[ch][bin] = s->pre_mantissa[ch][bin][blk] >> s->dexps[ch][bin];
++ }
++ }
++}
++
+ /**
+ * Get the transform coefficients.
+ */
+-static void get_transform_coeffs(AC3DecodeContext *s)
++static void get_transform_coeffs(AC3DecodeContext *s, int blk)
+ {
+ int ch, end;
+ int got_cplchan = 0;
+@@ -546,12 +577,12 @@
+
+ for (ch = 1; ch <= s->channels; ch++) {
+ /* transform coefficients for full-bandwidth channel */
+- get_transform_coeffs_ch(s, ch, &m);
++ get_transform_coeffs_ch(s, blk, ch, &m);
+ /* tranform coefficients for coupling channel come right after the
+ coefficients for the first coupled channel*/
+ if (s->channel_in_cpl[ch]) {
+ if (!got_cplchan) {
+- get_transform_coeffs_ch(s, CPL_CH, &m);
++ get_transform_coeffs_ch(s, blk, CPL_CH, &m);
+ calc_transform_coeffs_cpl(s);
+ got_cplchan = 1;
+ }
+@@ -657,7 +688,7 @@
+ */
+ static void ac3_upmix_delay(AC3DecodeContext *s)
+ {
+- int channel_data_size = 128*sizeof(float);
++ int channel_data_size = sizeof(s->delay[0]);
+ switch(s->channel_mode) {
+ case AC3_CHMODE_DUALMONO:
+ case AC3_CHMODE_STEREO:
+@@ -698,19 +729,23 @@
+
+ /* block switch flags */
+ different_transforms = 0;
++ if (s->block_switch_syntax) {
+ for (ch = 1; ch <= fbw_channels; ch++) {
+ s->block_switch[ch] = get_bits1(gbc);
+ if(ch > 1 && s->block_switch[ch] != s->block_switch[1])
+ different_transforms = 1;
+ }
++ }
+
+ /* dithering flags */
++ if (s->dither_flag_syntax) {
+ s->dither_all = 1;
+ for (ch = 1; ch <= fbw_channels; ch++) {
+ s->dither_flag[ch] = get_bits1(gbc);
+ if(!s->dither_flag[ch])
+ s->dither_all = 0;
+ }
++ }
+
+ /* dynamic range */
+ i = !(s->channel_mode);
+@@ -723,9 +758,23 @@
+ }
+ } while(i--);
+
++ /* spectral extension strategy */
++ if (s->eac3 && (!blk || get_bits1(gbc))) {
++ if (get_bits1(gbc)) {
++ av_log_missing_feature(s->avctx, "Spectral extension", 1);
++ return -1;
++ }
++ /* TODO: parse spectral extension strategy info */
++ }
++
++ /* TODO: spectral extension coordinates */
++
+ /* coupling strategy */
+- if (get_bits1(gbc)) {
++ if (!s->eac3)
++ s->cpl_strategy_exists[blk] = get_bits1(gbc);
++ if (s->cpl_strategy_exists[blk]) {
+ memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS);
++ if (!s->eac3)
+ s->cpl_in_use[blk] = get_bits1(gbc);
+ if (s->cpl_in_use[blk]) {
+ /* coupling in use */
+@@ -736,15 +785,28 @@
+ return -1;
+ }
+
++ /* check for enhanced coupling */
++ if (s->eac3 && get_bits1(gbc)) {
++ /* TODO: parse enhanced coupling strategy info */
++ av_log_missing_feature(s->avctx, "Enhanced coupling", 1);
++ return -1;
++ }
++
+ /* determine which channels are coupled */
++ if (s->eac3 && s->channel_mode == AC3_CHMODE_STEREO) {
++ s->channel_in_cpl[1] = 1;
++ s->channel_in_cpl[2] = 1;
++ } else {
+ for (ch = 1; ch <= fbw_channels; ch++)
+ s->channel_in_cpl[ch] = get_bits1(gbc);
++ }
+
+ /* phase flags in use */
+ if (channel_mode == AC3_CHMODE_STEREO)
+ s->phase_flags_in_use = get_bits1(gbc);
+
+- /* coupling frequency range and band structure */
++ /* coupling frequency range */
++ /* TODO: modify coupling end freq if spectral extension is used */
+ cpl_begin_freq = get_bits(gbc, 4);
+ cpl_end_freq = get_bits(gbc, 4);
+ if (3 + cpl_end_freq - cpl_begin_freq < 0) {
+@@ -754,24 +816,40 @@
+ s->num_cpl_bands = s->num_cpl_subbands = 3 + cpl_end_freq - cpl_begin_freq;
+ s->start_freq[CPL_CH] = cpl_begin_freq * 12 + 37;
+ s->end_freq[CPL_CH] = cpl_end_freq * 12 + 73;
++
++ /* coupling band structure */
++ if (!s->eac3 || get_bits1(gbc)) {
+ for (bnd = 0; bnd < s->num_cpl_subbands - 1; bnd++) {
+- if (get_bits1(gbc)) {
+- s->cpl_band_struct[bnd] = 1;
+- s->num_cpl_bands--;
++ s->cpl_band_struct[bnd] = get_bits1(gbc);
+ }
++ } else if (!blk) {
++ for (bnd = 0; bnd < s->num_cpl_subbands - 1; bnd++) {
++ s->cpl_band_struct[bnd] = ff_eac3_default_cpl_band_struct[bnd+cpl_begin_freq+1];
++ }
+ }
+ s->cpl_band_struct[s->num_cpl_subbands-1] = 0;
++
++ /* calculate number of coupling bands based on band structure */
++ for (bnd = 0; bnd < s->num_cpl_subbands-1; bnd++) {
++ s->num_cpl_bands -= s->cpl_band_struct[bnd];
++ }
+ } else {
+ /* coupling not in use */
+- for (ch = 1; ch <= fbw_channels; ch++)
++ for (ch = 1; ch <= fbw_channels; ch++) {
+ s->channel_in_cpl[ch] = 0;
++ s->first_cpl_coords[ch] = 1;
++ }
++ s->first_cpl_leak = 1;
++ s->phase_flags_in_use = 0;
+ }
+- } else if (!blk) {
++ } else if (!s->eac3) {
++ if(!blk) {
+ av_log(s->avctx, AV_LOG_ERROR, "new coupling strategy must be present in block 0\n");
+ return -1;
+ } else {
+ s->cpl_in_use[blk] = s->cpl_in_use[blk-1];
+ }
++ }
+ cpl_in_use = s->cpl_in_use[blk];
+
+ /* coupling coordinates */
+@@ -780,7 +858,17 @@
+
+ for (ch = 1; ch <= fbw_channels; ch++) {
+ if (s->channel_in_cpl[ch]) {
+- if (get_bits1(gbc)) {
++ int new_cpl_coords = 0;
++
++ /* determine if coupling coordinates are new or reused */
++ if (s->eac3 && s->first_cpl_coords[ch]) {
++ new_cpl_coords = 1;
++ s->first_cpl_coords[ch] = 0;
++ } else {
++ new_cpl_coords = get_bits1(gbc);
++ }
++
++ if (new_cpl_coords) {
+ int master_cpl_coord, cpl_coord_exp, cpl_coord_mant;
+ cpl_coords_exist = 1;
+ master_cpl_coord = 3 * get_bits(gbc, 2);
+@@ -797,6 +885,9 @@
+ av_log(s->avctx, AV_LOG_ERROR, "new coupling coordinates must be present in block 0\n");
+ return -1;
+ }
++ } else {
++ /* channel not in coupling */
++ s->first_cpl_coords[ch] = 1;
+ }
+ }
+ /* phase flags */
+@@ -809,7 +900,7 @@
+
+ /* stereo rematrixing strategy and band structure */
+ if (channel_mode == AC3_CHMODE_STEREO) {
+- if (get_bits1(gbc)) {
++ if ((s->eac3 && !blk) || get_bits1(gbc)) {
+ s->num_rematrixing_bands = 4;
+ if(cpl_in_use && s->start_freq[CPL_CH] <= 61)
+ s->num_rematrixing_bands -= 1 + (s->start_freq[CPL_CH] == 37);
+@@ -822,10 +913,14 @@
+ }
+
+ /* exponent strategies for each channel */
+- s->exp_strategy[blk][CPL_CH] = EXP_REUSE;
+- s->exp_strategy[blk][s->lfe_ch] = EXP_REUSE;
++ if (!s->eac3) {
++ for (ch = !cpl_in_use; ch <= s->channels; ch++) {
++ s->exp_strategy[blk][ch] = get_bits(gbc, 2 - (ch == s->lfe_ch));
++ }
++ }
++
++ /* check exponent strategies to set bit allocation stages */
+ for (ch = !cpl_in_use; ch <= s->channels; ch++) {
+- s->exp_strategy[blk][ch] = get_bits(gbc, 2 - (ch == s->lfe_ch));
+ if(s->exp_strategy[blk][ch] != EXP_REUSE)
+ bit_alloc_stages[ch] = 3;
+ }
+@@ -852,7 +947,7 @@
+ memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS);
+ }
+ }
+- if (cpl_in_use && s->exp_strategy[blk][CPL_CH] != EXP_REUSE) {
++ if (cpl_in_use) {
+ s->num_exp_groups[CPL_CH] = (s->end_freq[CPL_CH] - s->start_freq[CPL_CH]) /
+ (3 << (s->exp_strategy[blk][CPL_CH] - 1));
+ }
+@@ -870,6 +965,7 @@
+ }
+
+ /* bit allocation information */
++ if (s->bit_allocation_syntax) {
+ if (get_bits1(gbc)) {
+ s->bit_alloc_params.slow_decay = ff_ac3_slow_decay_tab[get_bits(gbc, 2)] >> s->bit_alloc_params.sr_shift;
+ s->bit_alloc_params.fast_decay = ff_ac3_fast_decay_tab[get_bits(gbc, 2)] >> s->bit_alloc_params.sr_shift;
+@@ -882,35 +978,78 @@
+ av_log(s->avctx, AV_LOG_ERROR, "new bit allocation info must be present in block 0\n");
+ return -1;
+ }
++ }
+
+ /* signal-to-noise ratio offsets and fast gains (signal-to-mask ratios) */
+- if (get_bits1(gbc)) {
++ if (s->snr_offset_strategy && (!s->eac3 || !blk) && get_bits1(gbc)) {
++ int snr = 0;
+ int csnr;
+ csnr = (get_bits(gbc, 6) - 15) << 4;
+- for (ch = !cpl_in_use; ch <= s->channels; ch++) { /* snr offset and fast gain */
+- s->snr_offset[ch] = (csnr + get_bits(gbc, 4)) << 2;
+- s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)];
++ for (i = ch = !cpl_in_use; ch <= s->channels; ch++) {
++ /* snr offset */
++ if (ch == i || s->snr_offset_strategy == 2)
++ snr = (csnr + get_bits(gbc, 4)) << 2;
++ /* run at least last bit allocation stage if snr offset changes */
++ if(blk && s->snr_offset[ch] != snr) {
++ bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 1);
++ }
++ s->snr_offset[ch] = snr;
++
++ /* fast gain (normal AC-3 only) */
++ if (!s->eac3) {
++ int prev = s->fast_gain[ch];
++ s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)];
++ /* run last 2 bit allocation stages if fast gain changes */
++ if(blk && prev != s->fast_gain[ch])
++ bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
++ }
+ }
+- memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS);
+- } else if (!blk) {
++ } else if (!s->eac3 && !blk) {
+ av_log(s->avctx, AV_LOG_ERROR, "new snr offsets must be present in block 0\n");
+ return -1;
+ }
+
++ /* fast gain (E-AC-3 only) */
++ if (s->fast_gain_syntax && get_bits1(gbc)) {
++ for (ch = !cpl_in_use; ch <= s->channels; ch++) {
++ int prev = s->fast_gain[ch];
++ s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)];
++ /* run last 2 bit allocation stages if fast gain changes */
++ if(blk && prev != s->fast_gain[ch])
++ bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
++ }
++ } else if (s->eac3 && !blk) {
++ for (ch = !cpl_in_use; ch <= s->channels; ch++)
++ s->fast_gain[ch] = ff_ac3_fast_gain_tab[4];
++ }
++
++ /* E-AC-3 to AC-3 converter SNR offset */
++ if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT && get_bits1(gbc)) {
++ skip_bits(gbc, 10); // skip converter snr offset
++ }
++
+ /* coupling leak information */
+ if (cpl_in_use) {
+- if (get_bits1(gbc)) {
++ if (s->first_cpl_leak || get_bits1(gbc)) {
++ int prev_fl = s->bit_alloc_params.cpl_fast_leak;
++ int prev_sl = s->bit_alloc_params.cpl_slow_leak;
+ s->bit_alloc_params.cpl_fast_leak = get_bits(gbc, 3);
+ s->bit_alloc_params.cpl_slow_leak = get_bits(gbc, 3);
++ /* run last 2 bit allocation stages for coupling channel if
++ coupling leak changes */
++ if(blk && (prev_fl != s->bit_alloc_params.cpl_fast_leak ||
++ prev_sl != s->bit_alloc_params.cpl_slow_leak)) {
+ bit_alloc_stages[CPL_CH] = FFMAX(bit_alloc_stages[CPL_CH], 2);
+- } else if (!blk) {
++ }
++ } else if (!s->eac3 && !blk) {
+ av_log(s->avctx, AV_LOG_ERROR, "new coupling leak info must be present in block 0\n");
+ return -1;
+ }
++ s->first_cpl_leak = 0;
+ }
+
+ /* delta bit allocation information */
+- if (get_bits1(gbc)) {
++ if (s->dba_syntax && get_bits1(gbc)) {
+ /* delta bit allocation exists (strategy) */
+ for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
+ s->dba_mode[ch] = get_bits(gbc, 2);
+@@ -959,16 +1098,18 @@
+ }
+ if(bit_alloc_stages[ch] > 0) {
+ /* 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->start_freq[ch], s->end_freq[ch],
+ s->snr_offset[ch],
+ s->bit_alloc_params.floor,
+- ff_ac3_bap_tab, s->bap[ch]);
++ bap_tab, s->bap[ch]);
+ }
+ }
+
+ /* unused dummy data */
+- if (get_bits1(gbc)) {
++ if (s->skip_syntax && get_bits1(gbc)) {
+ int skipl = get_bits(gbc, 9);
+ while(skipl--)
+ skip_bits(gbc, 8);
+@@ -976,8 +1117,12 @@
+
+ /* unpack the transform coefficients
+ this also uncouples channels if coupling is in use. */
+- get_transform_coeffs(s);
++ get_transform_coeffs(s, blk);
+
++ /* TODO: generate enhanced coupling coordinates and uncouple */
++
++ /* TODO: apply spectral extension */
++
+ /* recover coefficients if rematrixing is in use */
+ if(s->channel_mode == AC3_CHMODE_STEREO)
+ do_rematrixing(s);
+@@ -1042,7 +1187,7 @@
+ 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. */
+- memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_MAX_FRAME_SIZE));
++ 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);
+@@ -1161,5 +1306,5 @@
+ .init = ac3_decode_init,
+ .close = ac3_decode_end,
+ .decode = ac3_decode_frame,
+- .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 / AC-3"),
++ .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 (AC-3, E-AC-3)"),
+ };
+Index: libavcodec/ac3dec.h
+===================================================================
+--- libavcodec/ac3dec.h (revision 14819)
++++ libavcodec/ac3dec.h (working copy)
+@@ -168,4 +168,16 @@
+ ///@}
+ } AC3DecodeContext;
+
++/**
++ * Parse the E-AC-3 frame header.
++ * This parses both the bit stream info and audio frame header.
++ */
++int ff_eac3_parse_header(AC3DecodeContext *s);
++
++/**
++ * Decode mantissas in a single channel for the entire frame.
++ * This is used when AHT mode is enabled.
++ */
++void ff_eac3_get_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
++
+ #endif /* FFMPEG_AC3DEC_H */
+Index: libavcodec/Makefile
+===================================================================
+--- libavcodec/Makefile (revision 14819)
++++ libavcodec/Makefile (working copy)
+@@ -26,7 +26,7 @@
+ OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
+
+ OBJS-$(CONFIG_AASC_DECODER) += aasc.o
+-OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3tab.o ac3dec_data.o ac3.o mdct.o fft.o
++OBJS-$(CONFIG_AC3_DECODER) += eac3dec.o ac3dec.o ac3tab.o ac3dec_data.o ac3.o mdct.o fft.o
+ OBJS-$(CONFIG_AC3_ENCODER) += ac3enc.o ac3tab.o ac3.o
+ OBJS-$(CONFIG_ALAC_DECODER) += alac.o
+ OBJS-$(CONFIG_AMV_DECODER) += sp5xdec.o mjpegdec.o mjpeg.o
+Index: libavcodec/ac3enc.c
+===================================================================
+--- libavcodec/ac3enc.c (revision 14819)
++++ libavcodec/ac3enc.c (working copy)
+@@ -1365,5 +1365,5 @@
+ AC3_encode_close,
+ NULL,
+ .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+- .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 / AC-3"),
++ .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 (AC-3, E-AC-3)"),
+ };
diff --git a/media-video/ffmpeg/files/ffmpeg-icc.patch b/media-video/ffmpeg/files/ffmpeg-icc.patch
new file mode 100644
index 0000000..18be12a
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-icc.patch
@@ -0,0 +1,14 @@
+Index: libswscale/yuv2rgb.c
+===================================================================
+--- libswscale/yuv2rgb.c (Revision 27482)
++++ libswscale/yuv2rgb.c (Arbeitskopie)
+@@ -157,6 +157,9 @@
+
+ // The volatile is required because gcc otherwise optimizes some writes away
+ // not knowing that these are read in the ASM block.
++#ifdef __ICC
++#define static
++#endif
+ static volatile uint64_t attribute_used __attribute__((aligned(8))) b5Dither;
+ static volatile uint64_t attribute_used __attribute__((aligned(8))) g5Dither;
+ static volatile uint64_t attribute_used __attribute__((aligned(8))) g6Dither;
diff --git a/media-video/ffmpeg/files/ffmpeg-libdir-pic.patch b/media-video/ffmpeg/files/ffmpeg-libdir-pic.patch
new file mode 100755
index 0000000..7a0e42d
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-libdir-pic.patch
@@ -0,0 +1,169 @@
+Index: configure
+===================================================================
+RCS file: /cvsroot/ffmpeg/ffmpeg/configure,v
+retrieving revision 1.164
+diff -u -b -B -u -r1.164 configure
+--- configure 9 Mar 2005 03:04:55 -0000 1.164
++++ configure 15 Mar 2005 23:40:10 -0000
+@@ -13,6 +13,7 @@
+ echo "Standard options:"
+ echo " --help print this message"
+ echo " --prefix=PREFIX install in PREFIX [$prefix]"
++echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
+ echo " --mandir=DIR man documentation in DIR [PREFIX/man]"
+ echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
+ echo " --enable-ogg enable ogg support via libogg [default=no]"
+@@ -91,6 +92,7 @@
+
+ # default parameters
+ prefix="/usr/local"
++libdir=""
+ mandir=""
+ bindir=""
+ cross_prefix=""
+@@ -376,6 +378,8 @@
+ case "$opt" in
+ --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
+ ;;
++ --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`
++ ;;
+ --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
+ ;;
+ --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
+@@ -1062,6 +1066,10 @@
+ bindir="${prefix}/bin"
+ fi
+
++if test x"$libdir" = x""; then
++libdir="${prefix}/lib"
++fi
++
+ if test x"$mandir" = x""; then
+ mandir="${prefix}/man"
+ fi
+@@ -1138,6 +1146,7 @@
+ echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
+
+ echo "prefix=$prefix" >> config.mak
++echo "libdir=$libdir" >> config.mak
+ echo "bindir=$bindir" >> config.mak
+ echo "mandir=$mandir" >> config.mak
+ echo "MAKE=$make" >> config.mak
+Index: libavcodec/Makefile
+===================================================================
+RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/Makefile,v
+retrieving revision 1.177
+diff -u -b -B -u -r1.177 Makefile
+--- libavcodec/Makefile 9 Mar 2005 19:46:31 -0000 1.177
++++ libavcodec/Makefile 15 Mar 2005 23:40:10 -0000
+@@ -302,9 +302,9 @@
+ ifeq ($(CONFIG_WIN32),yes)
+ install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
+ else
+- install -d $(prefix)/lib
+- install $(INSTALLSTRIP) -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
+- ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
++ install -d $(libdir)
++ install $(INSTALLSTRIP) -m 755 $(SLIB) $(libdir)/libavcodec-$(VERSION).so
++ ln -sf libavcodec-$(VERSION).so $(libdir)/libavcodec.so
+ ldconfig || true
+ endif
+ ifeq ($(CONFIG_PP),yes)
+@@ -315,7 +315,7 @@
+ endif
+
+ installlib: all install-headers
+- install -m 644 $(LIB) "$(prefix)/lib"
++ install -m 644 $(LIB) "$(libdir)"
+
+ install-headers:
+ mkdir -p "$(prefix)/include/ffmpeg"
+Index: libavcodec/libpostproc/Makefile
+===================================================================
+RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/libpostproc/Makefile,v
+retrieving revision 1.19
+diff -u -b -B -u -r1.19 Makefile
+--- libavcodec/libpostproc/Makefile 4 Feb 2005 03:29:50 -0000 1.19
++++ libavcodec/libpostproc/Makefile 15 Mar 2005 23:40:11 -0000
+@@ -54,9 +54,9 @@
+ ifeq ($(CONFIG_WIN32),yes)
+ install $(INSTALLSTRIP) -m 755 $(SPPLIB) "$(prefix)"
+ else
+- install -d $(prefix)/lib
+- install $(INSTALLSTRIP) -m 755 $(SPPLIB) $(prefix)/lib/$(SPPLIB).$(SPPVERSION)
+- ln -sf $(SPPLIB).$(SPPVERSION) $(prefix)/lib/$(SPPLIB)
++ install -d $(libdir)
++ install $(INSTALLSTRIP) -m 755 $(SPPLIB) $(libdir)/$(SPPLIB).$(SPPVERSION)
++ ln -sf $(SPPLIB).$(SPPVERSION) $(libdir)/$(SPPLIB)
+ ldconfig || true
+ endif
+ endif
+Index: libavformat/Makefile
+===================================================================
+RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/Makefile,v
+retrieving revision 1.84
+diff -u -b -B -u -r1.84 Makefile
+--- libavformat/Makefile 15 Mar 2005 12:37:39 -0000 1.84
++++ libavformat/Makefile 15 Mar 2005 23:40:11 -0000
+@@ -108,9 +108,9 @@
+ ifeq ($(CONFIG_WIN32),yes)
+ install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
+ else
+- install -d $(prefix)/lib
+- install $(INSTALLSTRIP) -m 755 $(SLIB) $(prefix)/lib/libavformat-$(VERSION).so
+- ln -sf libavformat-$(VERSION).so $(prefix)/lib/libavformat.so
++ install -d $(libdir)
++ install $(INSTALLSTRIP) -m 755 $(SLIB) $(libdir)/libavformat-$(VERSION).so
++ ln -sf libavformat-$(VERSION).so $(libdir)/libavformat.so
+ ldconfig || true
+ endif
+ else
+@@ -118,7 +118,7 @@
+ endif
+
+ installlib: all install-headers
+- install -m 644 $(LIB) "$(prefix)/lib"
++ install -m 644 $(LIB) "$(libdir)"
+
+ install-headers:
+ mkdir -p "$(prefix)/include/ffmpeg"
+Index: vhook/Makefile
+===================================================================
+RCS file: /cvsroot/ffmpeg/ffmpeg/vhook/Makefile,v
+retrieving revision 1.19
+diff -u -b -B -u -r1.19 Makefile
+--- vhook/Makefile 25 Feb 2005 22:22:20 -0000 1.19
++++ vhook/Makefile 15 Mar 2005 23:40:11 -0000
+@@ -26,8 +26,8 @@
+ $(CC) -MM $(CFLAGS) $^ 1>.depend
+
+ install:
+- install -d "$(prefix)/lib/vhook"
+- install -m 755 $(HOOKS) "$(prefix)/lib/vhook"
++ install -d "$(libdir)/vhook"
++ install -m 755 $(HOOKS) "$(libdir)/vhook"
+
+ imlib2.so: imlib2.o
+ $(CC) -g -o $@ $(SHFLAGS) $< -lImlib2
+--- libavcodec/Makefile.orig 2005-03-18 06:10:21.000000000 +0900
++++ libavcodec/Makefile 2005-03-18 06:17:04.000000000 +0900
+@@ -7,7 +7,7 @@
+ VPATH=$(SRC_PATH)/libavcodec
+
+ # NOTE: -I.. is needed to include config.h
+-CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
++CFLAGS=$(OPTFLAGS) $(PIC) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+
+ OBJS= bitstream.o utils.o mem.o allcodecs.o \
+ mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
+--- libavformat/Makefile.orig 2005-02-25 00:18:02.000000000 +0900
++++ libavformat/Makefile 2005-03-18 06:17:22.000000000 +0900
+@@ -6,7 +6,7 @@
+
+ VPATH=$(SRC_PATH)/libavformat
+
+-CFLAGS=$(OPTFLAGS) -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
++CFLAGS=$(OPTFLAGS) $(PIC) -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+
+ OBJS= utils.o cutils.o os_support.o allformats.o
+ PPOBJS=
diff --git a/media-video/ffmpeg/files/ffmpeg-libdir.patch b/media-video/ffmpeg/files/ffmpeg-libdir.patch
new file mode 100755
index 0000000..82b8838
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-libdir.patch
@@ -0,0 +1,11 @@
+--- configure.orig 2007-01-20 10:18:40.000000000 -0800
++++ configure 2007-01-20 10:20:31.000000000 -0800
+@@ -2093,7 +2093,7 @@
+ cat <<EOF >$name.pc
+ prefix=$prefix
+ exec_prefix=\${prefix}
+-libdir=\${exec_prefix}/lib
++libdir=\${exec_prefix}/GENTOOLIBDIR
+ includedir=\${prefix}/include
+
+ Name: $name
diff --git a/media-video/ffmpeg/files/ffmpeg-shared-gcc4.1.patch b/media-video/ffmpeg/files/ffmpeg-shared-gcc4.1.patch
new file mode 100755
index 0000000..680c755
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-shared-gcc4.1.patch
@@ -0,0 +1,40 @@
+--- ffmpeg.orig/libavcodec/i386/dsputil_mmx.c 2006-03-04 07:50:27.000000000 +0100
++++ ffmpeg/libavcodec/i386/dsputil_mmx.c 2006-03-04 07:49:04.000000000 +0100
+@@ -619,10 +619,22 @@
+
+ static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){
+ asm volatile( //FIXME could save 1 instruction if done as 8x4 ...
+- "movd %4, %%mm0 \n\t"
+- "movd %5, %%mm1 \n\t"
+- "movd %6, %%mm2 \n\t"
+- "movd %7, %%mm3 \n\t"
++ "movd %0, %%mm0 \n\t"
++ "movd %1, %%mm1 \n\t"
++ "movd %2, %%mm2 \n\t"
++
++ :
++ : "m" (*(uint32_t*)(src + 0*src_stride)),
++ "m" (*(uint32_t*)(src + 1*src_stride)),
++ "m" (*(uint32_t*)(src + 2*src_stride))
++ );
++ asm volatile( //FIXME could save 1 instruction if done as 8x4 ...
++ "movd %0, %%mm3 \n\t"
++
++ :
++ : "m" (*(uint32_t*)(src + 3*src_stride))
++ );
++ asm volatile( //FIXME could save 1 instruction if done as 8x4 ...
+ "punpcklbw %%mm1, %%mm0 \n\t"
+ "punpcklbw %%mm3, %%mm2 \n\t"
+ "movq %%mm0, %%mm1 \n\t"
+@@ -639,10 +651,6 @@
+ "=m" (*(uint32_t*)(dst + 1*dst_stride)),
+ "=m" (*(uint32_t*)(dst + 2*dst_stride)),
+ "=m" (*(uint32_t*)(dst + 3*dst_stride))
+- : "m" (*(uint32_t*)(src + 0*src_stride)),
+- "m" (*(uint32_t*)(src + 1*src_stride)),
+- "m" (*(uint32_t*)(src + 2*src_stride)),
+- "m" (*(uint32_t*)(src + 3*src_stride))
+ );
+ }
+
diff --git a/media-video/ffmpeg/files/ffmpeg-soname-symlink.patch b/media-video/ffmpeg/files/ffmpeg-soname-symlink.patch
new file mode 100755
index 0000000..9fd7713
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-soname-symlink.patch
@@ -0,0 +1,146 @@
+Index: configure
+===================================================================
+RCS file: /cvsroot/ffmpeg/ffmpeg/configure,v
+retrieving revision 1.219
+diff -u -r1.219 configure
+--- configure 11 Dec 2005 00:45:33 -0000 1.219
++++ configure 13 Dec 2005 16:16:02 -0000
+@@ -215,12 +215,12 @@
+ dlfcn="no"
+ dlopen="no"
+ mpegaudio_hp="yes"
+-SHFLAGS='-shared -Wl,-soname,$@.$(LIBVERSION)'
++SHFLAGS='-shared -Wl,-soname,$@.$(LIBMAJOR)'
+ netserver="no"
+ need_inet_aton="no"
+ ffserver="yes"
+ ffplay="yes"
+-LIBOBJFLAGS=""
++LIBOBJFLAGS='$(PIC)'
+ LDFLAGS=-Wl,--warn-common
+ FFSLDFLAGS=-Wl,-E
+ LDCONFIG="ldconfig"
+@@ -228,6 +228,8 @@
+ LIBSUF=".a"
+ SLIBPREF="lib"
+ SLIBSUF=".so"
++SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)$(SLIBSUF).$(LIBVERSION)'
++SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)$(SLIBSUF).$(LIBMAJOR)'
+ EXESUF=""
+ BUILDSUF=""
+ amr_nb="no"
+@@ -339,6 +341,8 @@
+ installstrip=""
+ LDFLAGS="-Wl,-dynamic,-search_paths_first"
+ SLIBSUF=".dylib"
++SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
++SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
+ FFSLDFLAGS=-Wl,-bind_at_load
+ ;;
+ MINGW32*)
+@@ -1465,6 +1467,8 @@
+ echo "LAVFVERSION=$lavf_version" >> config.mak
+ echo "LAVUMAJOR=${lavu_version/.*/}" >> config.mak
+ echo "LAVUVERSION=$lavu_version" >> config.mak
++ echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
++ echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
+ fi
+ echo "EXTRALIBS=$extralibs" >> config.mak
+ version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
+Index: libavcodec/Makefile
+===================================================================
+RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/Makefile,v
+retrieving revision 1.215
+diff -u -r1.215 Makefile
+--- libavcodec/Makefile 10 Dec 2005 17:14:23 -0000 1.215
++++ libavcodec/Makefile 13 Dec 2005 16:16:03 -0000
+@@ -488,14 +488,20 @@
+ $(CC) -o $@ $^ $(LIBAVUTIL) -lm
+
+ ifeq ($(BUILD_SHARED),yes)
+-LIBVERSION=$(LAVCMAJOR)
++LIBVERSION=$(LAVCVERSION)
++LIBMAJOR=$(LAVCMAJOR)
++NAME=avcodec
+ install: all install-headers
+ ifeq ($(CONFIG_WIN32),yes)
+ install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
+ else
+ install -d $(libdir)
+- install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/libavcodec-$(VERSION)$(SLIBSUF)
+- ln -sf libavcodec-$(VERSION)$(SLIBSUF) $(libdir)/libavcodec$(SLIBSUF)
++ install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
++ $(libdir)/$(SLIBNAME_WITH_VERSION)
++ ln -sf $(SLIBNAME_WITH_VERSION) \
++ $(libdir)/$(SLIBNAME_WITH_MAJOR)
++ ln -sf $(SLIBNAME_WITH_VERSION) \
++ $(libdir)/$(SLIBNAME)
+ $(LDCONFIG) || true
+ endif
+ ifeq ($(CONFIG_PP),yes)
+Index: libavformat/Makefile
+===================================================================
+RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/Makefile,v
+retrieving revision 1.103
+diff -u -r1.103 Makefile
+--- libavformat/Makefile 10 Dec 2005 17:14:23 -0000 1.103
++++ libavformat/Makefile 13 Dec 2005 16:16:03 -0000
+@@ -80,7 +80,9 @@
+
+ LIB= $(LIBPREF)avformat$(LIBSUF)
+ ifeq ($(BUILD_SHARED),yes)
+-LIBVERSION=$(LAVFMAJOR)
++LIBVERSION=$(LAVFVERSION)
++LIBMAJOR=$(LAVFMAJOR)
++NAME=avformat
+ SLIBNAME= $(SLIBPREF)avformat$(SLIBSUF)
+ AVCLIBS+=-lavcodec$(BUILDSUF) -L../libavcodec -lavutil$(BUILDSUF) -L../libavutil
+ ifeq ($(CONFIG_DARWIN),yes)
+@@ -114,8 +116,12 @@
+ install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
+ else
+ install -d $(libdir)
+- install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/$(SLIBPREF)avformat-$(VERSION)$(SLIBSUF)
+- ln -sf $(SLIBPREF)avformat-$(VERSION)$(SLIBSUF) $(libdir)/$(SLIBNAME)
++ install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
++ $(libdir)/$(SLIBNAME_WITH_VERSION)
++ ln -sf $(SLIBNAME_WITH_VERSION) \
++ $(libdir)/$(SLIBNAME_WITH_MAJOR)
++ ln -sf $(SLIBNAME_WITH_VERSION) \
++ $(libdir)/$(SLIBNAME)
+ $(LDCONFIG) || true
+ endif
+ else
+Index: libavutil/Makefile
+===================================================================
+RCS file: /cvsroot/ffmpeg/ffmpeg/libavutil/Makefile,v
+retrieving revision 1.5
+diff -u -r1.5 Makefile
+--- libavutil/Makefile 10 Dec 2005 17:14:24 -0000 1.5
++++ libavutil/Makefile 13 Dec 2005 16:16:05 -0000
+@@ -22,7 +22,9 @@
+
+ LIB= $(LIBPREF)avutil$(LIBSUF)
+ ifeq ($(BUILD_SHARED),yes)
+-LIBVERSION=$(LAVUMAJOR)
++LIBVERSION=$(LAVUVERSION)
++LIBMAJOR=$(LAVUMAJOR)
++NAME=avutil
+ SLIBNAME= $(SLIBPREF)avutil$(SLIBSUF)
+ ifeq ($(CONFIG_DARWIN),yes)
+ SHFLAGS += -Wl,-install_name,$(libdir)/$(SLIBNAME),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION)
+@@ -65,8 +67,12 @@
+ install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
+ else
+ install -d $(libdir)
+- install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/libavutil-$(VERSION)$(SLIBSUF)
+- ln -sf libavutil-$(VERSION)$(SLIBSUF) $(libdir)/$(SLIBNAME)
++ install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
++ $(libdir)/$(SLIBNAME_WITH_VERSION)
++ ln -sf $(SLIBNAME_WITH_VERSION) \
++ $(libdir)/$(SLIBNAME_WITH_MAJOR)
++ ln -sf $(SLIBNAME_WITH_VERSION) \
++ $(libdir)/$(SLIBNAME)
+ $(LDCONFIG) || true
+ endif
+ else
diff --git a/media-video/ffmpeg/files/ffmpeg-unknown-options.patch b/media-video/ffmpeg/files/ffmpeg-unknown-options.patch
new file mode 100755
index 0000000..ca02e9b
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-unknown-options.patch
@@ -0,0 +1,16 @@
+Index: configure
+===================================================================
+RCS file: /cvsroot/ffmpeg/ffmpeg/configure,v
+retrieving revision 1.215
+diff -u -r1.215 configure
+--- configure 22 Oct 2005 19:17:39 -0000 1.215
++++ configure 20 Nov 2005 17:07:53 -0000
+@@ -580,8 +580,6 @@
+ ;;
+ *)
+ echo "Unknown option \"$opt\"."
+- echo "See $0 --help for available options."
+- exit 1
+ ;;
+ esac
+ done
diff --git a/media-video/ffmpeg/files/ffmpeg-x86-pic-fix-20080916.patch b/media-video/ffmpeg/files/ffmpeg-x86-pic-fix-20080916.patch
new file mode 100644
index 0000000..58799b9
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-x86-pic-fix-20080916.patch
@@ -0,0 +1,11 @@
+--- orig/libavcodec/cabac.h 2008-09-16 21:49:38.000000000 +0200
++++ ffmpeg/libavcodec/cabac.h 2008-09-16 21:49:03.000000000 +0200
+@@ -32,7 +32,7 @@
+ //#undef NDEBUG
+ #include <assert.h>
+ #include "libavutil/x86_cpu.h"
+-
++#define BROKEN_RELOCATIONS 1
+ #define CABAC_BITS 16
+ #define CABAC_MASK ((1<<CABAC_BITS)-1)
+ #define BRANCHLESS_CABAC_DECODER 1
diff --git a/media-video/ffmpeg/files/ffmpeg-x86-pic-fix.patch b/media-video/ffmpeg/files/ffmpeg-x86-pic-fix.patch
new file mode 100644
index 0000000..8bcda2a
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-x86-pic-fix.patch
@@ -0,0 +1,10 @@
+--- orig/libavcodec/cabac.h 2008-05-10 17:28:08.000000000 +0200
++++ ffmpeg/libavcodec/cabac.h 2008-05-10 17:29:24.000000000 +0200
+@@ -33,6 +33,7 @@
+ #include <assert.h>
+ #ifdef ARCH_X86
+ #include "libavutil/x86_cpu.h"
++#define BROKEN_RELOCATIONS 1
+ #endif
+
+ #define CABAC_BITS 16