diff --git a/pkgs/applications/video/handbrake/default.nix b/pkgs/applications/video/handbrake/default.nix index d13995f6e9b..9f1dfb2d6b0 100644 --- a/pkgs/applications/video/handbrake/default.nix +++ b/pkgs/applications/video/handbrake/default.nix @@ -1,13 +1,9 @@ -# Handbrake normally uses its own copies of the libraries it uses, for better -# control over library patches. +# Upstream distributes HandBrake with bundle of according versions of libraries and patches to them. # -# This derivation patches HB so it doesn't do that. The relevant patches -# are added to the Nix packages and proposed upstream instead. In several cases -# upstream already incorporated these patches. -# This has the benefits of providing improvements to other packages, -# making licenses more clear and reducing compile time/install size. +# Derivation patches HandBrake to use our closure. # -# Only tested on Linux + +# TODO: Release 1.2.0 would switch LibAV to FFmpeg. { stdenv, lib, fetchurl, python2, pkgconfig, yasm, harfbuzz, zlib, @@ -34,7 +30,7 @@ stdenv.mkDerivation rec { }; patched_libav_12 = libav_12.overrideAttrs (super: { - # 2018-04-26: HandBrake compilation (1.1.0) requires a patch of LibAV (12.3) from HandBrake team. This patch not went LibAV upstream. + # NOTE: 2018-04-26: HandBrake compilation (1.1.0) requires a patch of LibAV (12.3) from HandBrake team. This patch not went LibAV upstream. patches = (super.patches or []) ++ [( fetchurl { url = ''https://raw.githubusercontent.com/HandBrake/HandBrake/9e1f245708a157231c427c0ef9b91729d59a30e1/contrib/ffmpeg/A21-mp4-sdtp.patch''; @@ -107,7 +103,6 @@ stdenv.mkDerivation rec { ''; license = licenses.gpl2; maintainers = with maintainers; [ Anton-Latukha wmertens ]; - # Not tested on anything else platforms = platforms.linux; }; } diff --git a/pkgs/development/libraries/a52dec/A00-a52-state-t-public.patch b/pkgs/development/libraries/a52dec/A00-a52-state-t-public.patch deleted file mode 100644 index 5e0af3577d6..00000000000 --- a/pkgs/development/libraries/a52dec/A00-a52-state-t-public.patch +++ /dev/null @@ -1,152 +0,0 @@ -diff -Naur a52dec.old/include/a52.h a52dec.new/include/a52.h ---- a52dec.old/include/a52.h 2002-01-28 06:37:54.000000000 +0100 -+++ a52dec.new/include/a52.h 2012-07-16 14:13:35.000000000 +0200 -@@ -30,7 +30,71 @@ - typedef double sample_t; - #endif - --typedef struct a52_state_s a52_state_t; -+typedef struct { -+ uint8_t bai; /* fine SNR offset, fast gain */ -+ uint8_t deltbae; /* delta bit allocation exists */ -+ int8_t deltba[50]; /* per-band delta bit allocation */ -+} ba_t; -+ -+typedef struct { -+ uint8_t exp[256]; /* decoded channel exponents */ -+ int8_t bap[256]; /* derived channel bit allocation */ -+} expbap_t; -+ -+typedef struct { -+ uint8_t fscod; /* sample rate */ -+ uint8_t halfrate; /* halfrate factor */ -+ uint8_t acmod; /* coded channels */ -+ uint8_t lfeon; /* coded lfe channel */ -+ sample_t clev; /* centre channel mix level */ -+ sample_t slev; /* surround channels mix level */ -+ -+ int output; /* type of output */ -+ sample_t level; /* output level */ -+ sample_t bias; /* output bias */ -+ -+ int dynrnge; /* apply dynamic range */ -+ sample_t dynrng; /* dynamic range */ -+ void * dynrngdata; /* dynamic range callback funtion and data */ -+ sample_t (* dynrngcall) (sample_t range, void * dynrngdata); -+ -+ uint8_t chincpl; /* channel coupled */ -+ uint8_t phsflginu; /* phase flags in use (stereo only) */ -+ uint8_t cplstrtmant; /* coupling channel start mantissa */ -+ uint8_t cplendmant; /* coupling channel end mantissa */ -+ uint32_t cplbndstrc; /* coupling band structure */ -+ sample_t cplco[5][18]; /* coupling coordinates */ -+ -+ /* derived information */ -+ uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */ -+ uint8_t ncplbnd; /* number of coupling bands */ -+ -+ uint8_t rematflg; /* stereo rematrixing */ -+ -+ uint8_t endmant[5]; /* channel end mantissa */ -+ -+ uint16_t bai; /* bit allocation information */ -+ -+ uint32_t * buffer_start; -+ uint16_t lfsr_state; /* dither state */ -+ uint32_t bits_left; -+ uint32_t current_word; -+ -+ uint8_t csnroffst; /* coarse SNR offset */ -+ ba_t cplba; /* coupling bit allocation parameters */ -+ ba_t ba[5]; /* channel bit allocation parameters */ -+ ba_t lfeba; /* lfe bit allocation parameters */ -+ -+ uint8_t cplfleak; /* coupling fast leak init */ -+ uint8_t cplsleak; /* coupling slow leak init */ -+ -+ expbap_t cpl_expbap; -+ expbap_t fbw_expbap[5]; -+ expbap_t lfe_expbap; -+ -+ sample_t * samples; -+ int downmixed; -+} a52_state_t; - - #define A52_CHANNEL 0 - #define A52_MONO 1 -diff -Naur a52dec.old/liba52/a52_internal.h a52dec.new/liba52/a52_internal.h ---- a52dec.old/liba52/a52_internal.h 2002-07-28 03:52:06.000000000 +0200 -+++ a52dec.new/liba52/a52_internal.h 2012-07-16 14:11:47.000000000 +0200 -@@ -21,72 +21,6 @@ - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - --typedef struct { -- uint8_t bai; /* fine SNR offset, fast gain */ -- uint8_t deltbae; /* delta bit allocation exists */ -- int8_t deltba[50]; /* per-band delta bit allocation */ --} ba_t; -- --typedef struct { -- uint8_t exp[256]; /* decoded channel exponents */ -- int8_t bap[256]; /* derived channel bit allocation */ --} expbap_t; -- --struct a52_state_s { -- uint8_t fscod; /* sample rate */ -- uint8_t halfrate; /* halfrate factor */ -- uint8_t acmod; /* coded channels */ -- uint8_t lfeon; /* coded lfe channel */ -- sample_t clev; /* centre channel mix level */ -- sample_t slev; /* surround channels mix level */ -- -- int output; /* type of output */ -- sample_t level; /* output level */ -- sample_t bias; /* output bias */ -- -- int dynrnge; /* apply dynamic range */ -- sample_t dynrng; /* dynamic range */ -- void * dynrngdata; /* dynamic range callback funtion and data */ -- sample_t (* dynrngcall) (sample_t range, void * dynrngdata); -- -- uint8_t chincpl; /* channel coupled */ -- uint8_t phsflginu; /* phase flags in use (stereo only) */ -- uint8_t cplstrtmant; /* coupling channel start mantissa */ -- uint8_t cplendmant; /* coupling channel end mantissa */ -- uint32_t cplbndstrc; /* coupling band structure */ -- sample_t cplco[5][18]; /* coupling coordinates */ -- -- /* derived information */ -- uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */ -- uint8_t ncplbnd; /* number of coupling bands */ -- -- uint8_t rematflg; /* stereo rematrixing */ -- -- uint8_t endmant[5]; /* channel end mantissa */ -- -- uint16_t bai; /* bit allocation information */ -- -- uint32_t * buffer_start; -- uint16_t lfsr_state; /* dither state */ -- uint32_t bits_left; -- uint32_t current_word; -- -- uint8_t csnroffst; /* coarse SNR offset */ -- ba_t cplba; /* coupling bit allocation parameters */ -- ba_t ba[5]; /* channel bit allocation parameters */ -- ba_t lfeba; /* lfe bit allocation parameters */ -- -- uint8_t cplfleak; /* coupling fast leak init */ -- uint8_t cplsleak; /* coupling slow leak init */ -- -- expbap_t cpl_expbap; -- expbap_t fbw_expbap[5]; -- expbap_t lfe_expbap; -- -- sample_t * samples; -- int downmixed; --}; -- - #define LEVEL_PLUS6DB 2.0 - #define LEVEL_PLUS3DB 1.4142135623730951 - #define LEVEL_3DB 0.7071067811865476 diff --git a/pkgs/development/libraries/a52dec/A01-thread-safe.patch b/pkgs/development/libraries/a52dec/A01-thread-safe.patch deleted file mode 100644 index 4ca2d1a0873..00000000000 --- a/pkgs/development/libraries/a52dec/A01-thread-safe.patch +++ /dev/null @@ -1,462 +0,0 @@ -diff -Naur a52dec.old/include/a52.h a52dec.new/include/a52.h ---- a52dec.old/include/a52.h 2012-07-16 14:24:14.000000000 +0200 -+++ a52dec.new/include/a52.h 2012-07-16 14:31:37.000000000 +0200 -@@ -42,6 +42,11 @@ - } expbap_t; - - typedef struct { -+ sample_t real; -+ sample_t imag; -+} complex_t; -+ -+typedef struct { - uint8_t fscod; /* sample rate */ - uint8_t halfrate; /* halfrate factor */ - uint8_t acmod; /* coded channels */ -@@ -94,6 +99,20 @@ - - sample_t * samples; - int downmixed; -+ -+ /* Root values for IFFT */ -+ sample_t * roots16; // size 3 -+ sample_t * roots32; // size 7 -+ sample_t * roots64; // size 15 -+ sample_t * roots128; // size 31 -+ -+ /* Twiddle factors for IMDCT */ -+ complex_t * pre1; // size 128 -+ complex_t * post1; // size 64 -+ complex_t * pre2; // size 64 -+ complex_t * post2; // size 32 -+ -+ sample_t * a52_imdct_window; // size 256 - } a52_state_t; - - #define A52_CHANNEL 0 -diff -Naur a52dec.old/liba52/a52_internal.h a52dec.new/liba52/a52_internal.h ---- a52dec.old/liba52/a52_internal.h 2012-07-16 14:24:14.000000000 +0200 -+++ a52dec.new/liba52/a52_internal.h 2012-07-16 14:28:33.000000000 +0200 -@@ -49,6 +49,6 @@ - sample_t clev, sample_t slev); - void a52_upmix (sample_t * samples, int acmod, int output); - --void a52_imdct_init (uint32_t mm_accel); --void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias); --void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias); -+void a52_imdct_init (a52_state_t * state, uint32_t mm_accel); -+void a52_imdct_256 (a52_state_t * state, sample_t * data, sample_t * delay, sample_t bias); -+void a52_imdct_512 (a52_state_t * state, sample_t * data, sample_t * delay, sample_t bias); -diff -Naur a52dec.old/liba52/imdct.c a52dec.new/liba52/imdct.c ---- a52dec.old/liba52/imdct.c 2012-07-16 14:24:14.000000000 +0200 -+++ a52dec.new/liba52/imdct.c 2012-07-16 14:33:00.000000000 +0200 -@@ -40,11 +40,6 @@ - #include "a52_internal.h" - #include "mm_accel.h" - --typedef struct complex_s { -- sample_t real; -- sample_t imag; --} complex_t; -- - static uint8_t fftorder[] = { - 0,128, 64,192, 32,160,224, 96, 16,144, 80,208,240,112, 48,176, - 8,136, 72,200, 40,168,232,104,248,120, 56,184, 24,152,216, 88, -@@ -56,22 +51,8 @@ - 6,134, 70,198, 38,166,230,102,246,118, 54,182, 22,150,214, 86 - }; - --/* Root values for IFFT */ --static sample_t roots16[3]; --static sample_t roots32[7]; --static sample_t roots64[15]; --static sample_t roots128[31]; -- --/* Twiddle factors for IMDCT */ --static complex_t pre1[128]; --static complex_t post1[64]; --static complex_t pre2[64]; --static complex_t post2[32]; -- --static sample_t a52_imdct_window[256]; -- --static void (* ifft128) (complex_t * buf); --static void (* ifft64) (complex_t * buf); -+static void (* ifft128) (a52_state_t * state, complex_t * buf); -+static void (* ifft64) (a52_state_t * state, complex_t * buf); - - static inline void ifft2 (complex_t * buf) - { -@@ -167,7 +148,7 @@ - a1.imag += tmp4; \ - } while (0) - --static inline void ifft8 (complex_t * buf) -+static inline void ifft8 (a52_state_t * state, complex_t * buf) - { - double tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8; - -@@ -175,7 +156,7 @@ - ifft2 (buf + 4); - ifft2 (buf + 6); - BUTTERFLY_ZERO (buf[0], buf[2], buf[4], buf[6]); -- BUTTERFLY_HALF (buf[1], buf[3], buf[5], buf[7], roots16[1]); -+ BUTTERFLY_HALF (buf[1], buf[3], buf[5], buf[7], state->roots16[1]); - } - - static void ifft_pass (complex_t * buf, sample_t * weight, int n) -@@ -205,66 +186,66 @@ - } while (--i); - } - --static void ifft16 (complex_t * buf) -+static void ifft16 (a52_state_t * state, complex_t * buf) - { -- ifft8 (buf); -+ ifft8 (state, buf); - ifft4 (buf + 8); - ifft4 (buf + 12); -- ifft_pass (buf, roots16 - 4, 4); -+ ifft_pass (buf, state->roots16 - 4, 4); - } - --static void ifft32 (complex_t * buf) -+static void ifft32 (a52_state_t * state, complex_t * buf) - { -- ifft16 (buf); -- ifft8 (buf + 16); -- ifft8 (buf + 24); -- ifft_pass (buf, roots32 - 8, 8); -+ ifft16 (state, buf); -+ ifft8 (state, buf + 16); -+ ifft8 (state, buf + 24); -+ ifft_pass (buf, state->roots32 - 8, 8); - } - --static void ifft64_c (complex_t * buf) -+static void ifft64_c (a52_state_t * state, complex_t * buf) - { -- ifft32 (buf); -- ifft16 (buf + 32); -- ifft16 (buf + 48); -- ifft_pass (buf, roots64 - 16, 16); -+ ifft32 (state, buf); -+ ifft16 (state, buf + 32); -+ ifft16 (state, buf + 48); -+ ifft_pass (buf, state->roots64 - 16, 16); - } - --static void ifft128_c (complex_t * buf) -+static void ifft128_c (a52_state_t * state, complex_t * buf) - { -- ifft32 (buf); -- ifft16 (buf + 32); -- ifft16 (buf + 48); -- ifft_pass (buf, roots64 - 16, 16); -+ ifft32 (state, buf); -+ ifft16 (state, buf + 32); -+ ifft16 (state, buf + 48); -+ ifft_pass (buf, state->roots64 - 16, 16); - -- ifft32 (buf + 64); -- ifft32 (buf + 96); -- ifft_pass (buf, roots128 - 32, 32); -+ ifft32 (state, buf + 64); -+ ifft32 (state, buf + 96); -+ ifft_pass (buf, state->roots128 - 32, 32); - } - --void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias) -+void a52_imdct_512 (a52_state_t * state, sample_t * data, sample_t * delay, sample_t bias) - { - int i, k; - sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2; -- const sample_t * window = a52_imdct_window; -+ const sample_t * window = state->a52_imdct_window; - complex_t buf[128]; - - for (i = 0; i < 128; i++) { - k = fftorder[i]; -- t_r = pre1[i].real; -- t_i = pre1[i].imag; -+ t_r = state->pre1[i].real; -+ t_i = state->pre1[i].imag; - - buf[i].real = t_i * data[255-k] + t_r * data[k]; - buf[i].imag = t_r * data[255-k] - t_i * data[k]; - } - -- ifft128 (buf); -+ ifft128 (state, buf); - - /* Post IFFT complex multiply plus IFFT complex conjugate*/ - /* Window and convert to real valued signal */ - for (i = 0; i < 64; i++) { - /* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ; */ -- t_r = post1[i].real; -- t_i = post1[i].imag; -+ t_r = state->post1[i].real; -+ t_i = state->post1[i].imag; - - a_r = t_r * buf[i].real + t_i * buf[i].imag; - a_i = t_i * buf[i].real - t_r * buf[i].imag; -@@ -285,18 +266,18 @@ - } - } - --void a52_imdct_256(sample_t * data, sample_t * delay, sample_t bias) -+void a52_imdct_256(a52_state_t * state, sample_t * data, sample_t * delay, sample_t bias) - { - int i, k; - sample_t t_r, t_i, a_r, a_i, b_r, b_i, c_r, c_i, d_r, d_i, w_1, w_2; -- const sample_t * window = a52_imdct_window; -+ const sample_t * window = state->a52_imdct_window; - complex_t buf1[64], buf2[64]; - - /* Pre IFFT complex multiply plus IFFT cmplx conjugate */ - for (i = 0; i < 64; i++) { - k = fftorder[i]; -- t_r = pre2[i].real; -- t_i = pre2[i].imag; -+ t_r = state->pre2[i].real; -+ t_i = state->pre2[i].imag; - - buf1[i].real = t_i * data[254-k] + t_r * data[k]; - buf1[i].imag = t_r * data[254-k] - t_i * data[k]; -@@ -305,15 +286,15 @@ - buf2[i].imag = t_r * data[255-k] - t_i * data[k+1]; - } - -- ifft64 (buf1); -- ifft64 (buf2); -+ ifft64 (state, buf1); -+ ifft64 (state, buf2); - - /* Post IFFT complex multiply */ - /* Window and convert to real valued signal */ - for (i = 0; i < 32; i++) { - /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */ -- t_r = post2[i].real; -- t_i = post2[i].imag; -+ t_r = state->post2[i].real; -+ t_i = state->post2[i].imag; - - a_r = t_r * buf1[i].real + t_i * buf1[i].imag; - a_i = t_i * buf1[i].real - t_r * buf1[i].imag; -@@ -362,7 +343,7 @@ - return bessel; - } - --void a52_imdct_init (uint32_t mm_accel) -+void a52_imdct_init (a52_state_t * state, uint32_t mm_accel) - { - int i, k; - double sum; -@@ -371,50 +352,50 @@ - sum = 0; - for (i = 0; i < 256; i++) { - sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256)); -- a52_imdct_window[i] = sum; -+ state->a52_imdct_window[i] = sum; - } - sum++; - for (i = 0; i < 256; i++) -- a52_imdct_window[i] = sqrt (a52_imdct_window[i] / sum); -+ state->a52_imdct_window[i] = sqrt (state->a52_imdct_window[i] / sum); - - for (i = 0; i < 3; i++) -- roots16[i] = cos ((M_PI / 8) * (i + 1)); -+ state->roots16[i] = cos ((M_PI / 8) * (i + 1)); - - for (i = 0; i < 7; i++) -- roots32[i] = cos ((M_PI / 16) * (i + 1)); -+ state->roots32[i] = cos ((M_PI / 16) * (i + 1)); - - for (i = 0; i < 15; i++) -- roots64[i] = cos ((M_PI / 32) * (i + 1)); -+ state->roots64[i] = cos ((M_PI / 32) * (i + 1)); - - for (i = 0; i < 31; i++) -- roots128[i] = cos ((M_PI / 64) * (i + 1)); -+ state->roots128[i] = cos ((M_PI / 64) * (i + 1)); - - for (i = 0; i < 64; i++) { - k = fftorder[i] / 2 + 64; -- pre1[i].real = cos ((M_PI / 256) * (k - 0.25)); -- pre1[i].imag = sin ((M_PI / 256) * (k - 0.25)); -+ state->pre1[i].real = cos ((M_PI / 256) * (k - 0.25)); -+ state->pre1[i].imag = sin ((M_PI / 256) * (k - 0.25)); - } - - for (i = 64; i < 128; i++) { - k = fftorder[i] / 2 + 64; -- pre1[i].real = -cos ((M_PI / 256) * (k - 0.25)); -- pre1[i].imag = -sin ((M_PI / 256) * (k - 0.25)); -+ state->pre1[i].real = -cos ((M_PI / 256) * (k - 0.25)); -+ state->pre1[i].imag = -sin ((M_PI / 256) * (k - 0.25)); - } - - for (i = 0; i < 64; i++) { -- post1[i].real = cos ((M_PI / 256) * (i + 0.5)); -- post1[i].imag = sin ((M_PI / 256) * (i + 0.5)); -+ state->post1[i].real = cos ((M_PI / 256) * (i + 0.5)); -+ state->post1[i].imag = sin ((M_PI / 256) * (i + 0.5)); - } - - for (i = 0; i < 64; i++) { - k = fftorder[i] / 4; -- pre2[i].real = cos ((M_PI / 128) * (k - 0.25)); -- pre2[i].imag = sin ((M_PI / 128) * (k - 0.25)); -+ state->pre2[i].real = cos ((M_PI / 128) * (k - 0.25)); -+ state->pre2[i].imag = sin ((M_PI / 128) * (k - 0.25)); - } - - for (i = 0; i < 32; i++) { -- post2[i].real = cos ((M_PI / 128) * (i + 0.5)); -- post2[i].imag = sin ((M_PI / 128) * (i + 0.5)); -+ state->post2[i].real = cos ((M_PI / 128) * (i + 0.5)); -+ state->post2[i].imag = sin ((M_PI / 128) * (i + 0.5)); - } - - #ifdef LIBA52_DJBFFT -diff -Naur a52dec.old/liba52/parse.c a52dec.new/liba52/parse.c ---- a52dec.old/liba52/parse.c 2012-07-16 14:24:14.000000000 +0200 -+++ a52dec.new/liba52/parse.c 2012-07-16 14:33:00.000000000 +0200 -@@ -56,16 +56,53 @@ - a52_state_t * state; - int i; - -- state = malloc (sizeof (a52_state_t)); -+ state = calloc (1, sizeof (a52_state_t)); - if (state == NULL) - return NULL; - - state->samples = memalign (16, 256 * 12 * sizeof (sample_t)); - if (state->samples == NULL) { -- free (state); -- return NULL; -+ goto fail; - } - -+ /* Root values for IFFT */ -+ state->roots16 = memalign (16, 3 * sizeof (sample_t)); -+ if (state->roots16 == NULL) -+ goto fail; -+ -+ state->roots32 = memalign (16, 7 * sizeof (sample_t)); -+ if (state->roots32 == NULL) -+ goto fail; -+ -+ state->roots64 = memalign (16, 15 * sizeof (sample_t)); -+ if (state->roots64 == NULL) -+ goto fail; -+ -+ state->roots128 = memalign (16, 31 * sizeof (sample_t)); -+ if (state->roots128 == NULL) -+ goto fail; -+ -+ /* Twiddle factors for IMDCT */ -+ state->pre1 = memalign (16, 128 * sizeof (complex_t)); -+ if (state->pre1 == NULL) -+ goto fail; -+ -+ state->post1 = memalign (16, 64 * sizeof (complex_t)); -+ if (state->post1 == NULL) -+ goto fail; -+ -+ state->pre2 = memalign (16, 64 * sizeof (complex_t)); -+ if (state->pre2 == NULL) -+ goto fail; -+ -+ state->post2 = memalign (16, 32 * sizeof (complex_t)); -+ if (state->post2 == NULL) -+ goto fail; -+ -+ state->a52_imdct_window = memalign (16, 256 * sizeof (sample_t)); -+ if (state->a52_imdct_window == NULL) -+ goto fail; -+ - for (i = 0; i < 256 * 12; i++) - state->samples[i] = 0; - -@@ -73,9 +110,27 @@ - - state->lfsr_state = 1; - -- a52_imdct_init (mm_accel); -+ a52_imdct_init (state, mm_accel); - - return state; -+ -+fail: -+ if ( state ) -+ { -+ free (state->a52_imdct_window); -+ free (state->post2); -+ free (state->pre2); -+ free (state->post1); -+ free (state->pre1); -+ free (state->roots128); -+ free (state->roots64); -+ free (state->roots32); -+ free (state->roots16); -+ free (state->samples); -+ free (state); -+ } -+ return NULL; -+ - } - - sample_t * a52_samples (a52_state_t * state) -@@ -825,7 +880,7 @@ - state->dynrng, 0, 7); - for (i = 7; i < 256; i++) - (samples-256)[i] = 0; -- a52_imdct_512 (samples - 256, samples + 1536 - 256, state->bias); -+ a52_imdct_512 (state, samples - 256, samples + 1536 - 256, state->bias); - } else { - /* just skip the LFE coefficients */ - coeff_get (state, samples + 1280, &state->lfe_expbap, &quantizer, -@@ -854,10 +909,10 @@ - - if (coeff[i]) { - if (blksw[i]) -- a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i, -+ a52_imdct_256 (state, samples + 256 * i, samples + 1536 + 256 * i, - bias); - else -- a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i, -+ a52_imdct_512 (state, samples + 256 * i, samples + 1536 + 256 * i, - bias); - } else { - int j; -@@ -883,11 +938,11 @@ - - if (blksw[0]) - for (i = 0; i < nfchans; i++) -- a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i, -+ a52_imdct_256 (state, samples + 256 * i, samples + 1536 + 256 * i, - state->bias); - else - for (i = 0; i < nfchans; i++) -- a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i, -+ a52_imdct_512 (state, samples + 256 * i, samples + 1536 + 256 * i, - state->bias); - } - -@@ -896,6 +951,15 @@ - - void a52_free (a52_state_t * state) - { -+ free (state->a52_imdct_window); -+ free (state->post2); -+ free (state->pre2); -+ free (state->post1); -+ free (state->pre1); -+ free (state->roots128); -+ free (state->roots64); -+ free (state->roots32); -+ free (state->roots16); - free (state->samples); - free (state); - } diff --git a/pkgs/development/libraries/a52dec/A02-imdct-shutup.patch b/pkgs/development/libraries/a52dec/A02-imdct-shutup.patch deleted file mode 100644 index a22e5979e66..00000000000 --- a/pkgs/development/libraries/a52dec/A02-imdct-shutup.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Naur a52dec_original/liba52/imdct.c a52dec_patched/liba52/imdct.c ---- a52dec.old/liba52/imdct.c 2002-07-28 03:52:07.000000000 +0200 -+++ a52dec.new/liba52/imdct.c 2011-07-15 20:29:09.000000000 +0200 -@@ -425,7 +425,6 @@ - } else - #endif - { -- fprintf (stderr, "No accelerated IMDCT transform found\n"); - ifft128 = ifft128_c; - ifft64 = ifft64_c; - } diff --git a/pkgs/development/libraries/a52dec/A03-automake.patch b/pkgs/development/libraries/a52dec/A03-automake.patch deleted file mode 100644 index 142091dc695..00000000000 --- a/pkgs/development/libraries/a52dec/A03-automake.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur a52dec.orig/configure.in a52dec/configure.in ---- a52dec.orig/configure.in 2002-07-27 23:50:20.000000000 -0400 -+++ a52dec/configure.in 2013-01-28 21:06:27.000000000 -0500 -@@ -6,7 +6,7 @@ - AC_CONFIG_FILES([Makefile autotools/Makefile include/Makefile test/Makefile - doc/Makefile src/Makefile liba52/Makefile libao/Makefile vc++/Makefile]) - AM_INIT_AUTOMAKE([a52dec],[0.7.4]) --AM_CONFIG_HEADER(include/config.h) -+AC_CONFIG_HEADER(include/config.h) - AM_MAINTAINER_MODE - AC_CANONICAL_HOST - diff --git a/pkgs/development/libraries/a52dec/default.nix b/pkgs/development/libraries/a52dec/default.nix index d8a56a3d28e..0bfe3a88e9f 100644 --- a/pkgs/development/libraries/a52dec/default.nix +++ b/pkgs/development/libraries/a52dec/default.nix @@ -2,20 +2,12 @@ stdenv.mkDerivation rec { name = "a52dec-0.7.4p4"; - + src = fetchurl { url = "${meta.homepage}/files/a52dec-0.7.4.tar.gz"; sha256 = "0czccp4fcpf2ykp16xcrzdfmnircz1ynhls334q374xknd5747d2"; }; - # From Handbrake - patches = [ - ./A00-a52-state-t-public.patch - ./A01-thread-safe.patch - ./A02-imdct-shutup.patch - ./A03-automake.patch - ]; - meta = { description = "ATSC A/52 stream decoder"; homepage = http://liba52.sourceforge.net/; diff --git a/pkgs/development/libraries/libdvdnav/4.2.1.nix b/pkgs/development/libraries/libdvdnav/4.2.1.nix index 0d3f8349413..18e2689002e 100644 --- a/pkgs/development/libraries/libdvdnav/4.2.1.nix +++ b/pkgs/development/libraries/libdvdnav/4.2.1.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation { name = "libdvdnav-4.2.1"; - + src = fetchurl { url = http://dvdnav.mplayerhq.hu/releases/libdvdnav-4.2.1.tar.xz; sha256 = "7fca272ecc3241b6de41bbbf7ac9a303ba25cb9e0c82aa23901d3104887f2372"; @@ -17,9 +17,6 @@ stdenv.mkDerivation { mkdir -p $out ''; - # From Handbrake - patches = [ ./A08-dvdnav-dup.patch ./P00-mingw-no-examples.patch ]; - meta = { homepage = http://dvdnav.mplayerhq.hu/; description = "A library that implements DVD navigation features such as DVD menus"; diff --git a/pkgs/development/libraries/libdvdnav/A08-dvdnav-dup.patch b/pkgs/development/libraries/libdvdnav/A08-dvdnav-dup.patch deleted file mode 100644 index c0991b43555..00000000000 --- a/pkgs/development/libraries/libdvdnav/A08-dvdnav-dup.patch +++ /dev/null @@ -1,137 +0,0 @@ -Index: src/dvdnav.c -=================================================================== ---- libdvdnav.orig/src/dvdnav.c (revision 1168) -+++ libdvdnav/src/dvdnav.c (working copy) -@@ -71,6 +71,67 @@ - return DVDNAV_STATUS_OK; - } - -+dvdnav_status_t dvdnav_dup(dvdnav_t **dest, dvdnav_t *src) { -+ dvdnav_t *this; -+ -+ (*dest) = NULL; -+ this = (dvdnav_t*)malloc(sizeof(dvdnav_t)); -+ if(!this) -+ return DVDNAV_STATUS_ERR; -+ -+ memcpy(this, src, sizeof(dvdnav_t)); -+ this->file = NULL; -+ -+ pthread_mutex_init(&this->vm_lock, NULL); -+ -+ this->vm = vm_new_copy(src->vm); -+ if(!this->vm) { -+ printerr("Error initialising the DVD VM."); -+ pthread_mutex_destroy(&this->vm_lock); -+ free(this); -+ return DVDNAV_STATUS_ERR; -+ } -+ -+ /* Start the read-ahead cache. */ -+ this->cache = dvdnav_read_cache_new(this); -+ -+ (*dest) = this; -+ return DVDNAV_STATUS_OK; -+} -+ -+dvdnav_status_t dvdnav_free_dup(dvdnav_t *this) { -+ -+#ifdef LOG_DEBUG -+ fprintf(MSG_OUT, "libdvdnav: free_dup:called\n"); -+#endif -+ -+ if (this->file) { -+ pthread_mutex_lock(&this->vm_lock); -+ DVDCloseFile(this->file); -+#ifdef LOG_DEBUG -+ fprintf(MSG_OUT, "libdvdnav: close:file closing\n"); -+#endif -+ this->file = NULL; -+ pthread_mutex_unlock(&this->vm_lock); -+ } -+ -+ /* Free the VM */ -+ if(this->vm) -+ vm_free_copy(this->vm); -+ -+ pthread_mutex_destroy(&this->vm_lock); -+ -+ /* We leave the final freeing of the entire structure to the cache, -+ * because we don't know, if there are still buffers out in the wild, -+ * that must return first. */ -+ if(this->cache) -+ dvdnav_read_cache_free(this->cache); -+ else -+ free(this); -+ -+ return DVDNAV_STATUS_OK; -+} -+ - dvdnav_status_t dvdnav_open(dvdnav_t** dest, const char *path) { - dvdnav_t *this; - struct timeval time; -Index: src/dvdnav/dvdnav.h -=================================================================== ---- libdvdnav.orig/src/dvdnav/dvdnav.h (revision 1168) -+++ libdvdnav/src/dvdnav.h (working copy) -@@ -89,6 +89,9 @@ - */ - dvdnav_status_t dvdnav_open(dvdnav_t **dest, const char *path); - -+dvdnav_status_t dvdnav_dup(dvdnav_t **dest, dvdnav_t *src); -+dvdnav_status_t dvdnav_free_dup(dvdnav_t *this); -+ - /* - * Closes a dvdnav_t previously opened with dvdnav_open(), freeing any - * memory associated with it. -Index: src/vm/vm.c -=================================================================== ---- libdvdnav.orig/src/vm/vm.c (revision 1168) -+++ libdvdnav/src/vm/vm.c (working copy) -@@ -96,6 +98,7 @@ - - static pgcit_t* get_MENU_PGCIT(vm_t *vm, ifo_handle_t *h, uint16_t lang); - static pgcit_t* get_PGCIT(vm_t *vm); -+static void vm_close(vm_t *vm); - - - /* Helper functions */ -@@ -262,7 +265,7 @@ - } - - void vm_free_vm(vm_t *vm) { -- vm_stop(vm); -+ vm_close(vm); - free(vm); - } - -@@ -289,12 +292,20 @@ - - int vm_start(vm_t *vm) { - /* Set pgc to FP (First Play) pgc */ -+ if (vm->stopped) { -+ vm_reset(vm, NULL); -+ vm->stopped = 0; -+ } - set_FP_PGC(vm); - process_command(vm, play_PGC(vm)); - return !vm->stopped; - } - - void vm_stop(vm_t *vm) { -+ vm->stopped = 1; -+} -+ -+static void vm_close(vm_t *vm) { - if(vm->vmgi) { - ifoClose(vm->vmgi); - vm->vmgi=NULL; -@@ -346,7 +357,7 @@ - - if (vm->dvd && dvdroot) { - /* a new dvd device has been requested */ -- vm_stop(vm); -+ vm_close(vm); - } - if (!vm->dvd) { - vm->dvd = DVDOpen(dvdroot); diff --git a/pkgs/development/libraries/libdvdnav/P00-mingw-no-examples.patch b/pkgs/development/libraries/libdvdnav/P00-mingw-no-examples.patch deleted file mode 100644 index 0e061861735..00000000000 --- a/pkgs/development/libraries/libdvdnav/P00-mingw-no-examples.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -Naur libdvdnav.orig/Makefile.am libdvdnav/Makefile.am ---- libdvdnav.orig/Makefile.am 2008-10-03 16:11:46.000000000 -0400 -+++ libdvdnav/Makefile.am 2009-04-24 02:53:15.000000000 -0400 -@@ -1,7 +1,7 @@ - include $(top_srcdir)/misc/Makefile.common - - --SUBDIRS = src examples doc misc m4 -+SUBDIRS = src doc misc m4 - - EXTRA_DIST = autogen.sh \ - AUTHORS \ -diff -Naur libdvdnav.orig/configure.ac libdvdnav/configure.ac ---- libdvdnav.orig/configure.ac 2009-01-08 17:57:11.000000000 -0500 -+++ libdvdnav/configure.ac 2009-04-24 02:52:34.000000000 -0400 -@@ -252,5 +252,4 @@ - misc/relchk.sh - m4/Makefile - doc/Makefile --examples/Makefile - ]) diff --git a/pkgs/development/libraries/libmkv/A01-hbmv-pgs.patch b/pkgs/development/libraries/libmkv/A01-hbmv-pgs.patch deleted file mode 100644 index 9f863cac412..00000000000 --- a/pkgs/development/libraries/libmkv/A01-hbmv-pgs.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/include/libmkv.h b/include/libmkv.h -index 146a91f..f03d608 100644 ---- a/include/libmkv.h -+++ b/include/libmkv.h -@@ -94,6 +94,7 @@ extern "C" { - #define MK_SUBTITLE_USF "S_TEXT/USF" - #define MK_SUBTITLE_VOBSUB "S_VOBSUB" - #define MK_SUBTITLE_BMP "S_IMAGE/BMP" -+#define MK_SUBTITLE_PGS "S_HDMV/PGS" - - /* Official Tags */ - #define MK_TAG_TITLE "TITLE" diff --git a/pkgs/development/libraries/libmkv/A02-audio-out-sampling-freq.patch b/pkgs/development/libraries/libmkv/A02-audio-out-sampling-freq.patch deleted file mode 100644 index ea31957c1d2..00000000000 --- a/pkgs/development/libraries/libmkv/A02-audio-out-sampling-freq.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/include/libmkv.h b/include/libmkv.h -index 146a91f..f03d608 100644 ---- a/include/libmkv.h -+++ b/include/libmkv.h -@@ -203,6 +204,7 @@ struct mk_TrackConfig_s { - } video; - struct { - float samplingFreq; /* Sampling Frequency in Hz */ -+ float outputSamplingFreq; /* Playback Sampling Frequency in Hz (e.g. for AAC w/SBR) */ - unsigned channels; /* Number of channels for this track */ - unsigned bitDepth; /* Bits per sample (PCM) */ - } audio; -diff --git a/src/tracks.c b/src/tracks.c -index f9c7e48..a2a60ca 100644 ---- a/src/tracks.c -+++ b/src/tracks.c -@@ -174,6 +174,11 @@ mk_Track *mk_createTrack(mk_Writer *w, mk_TrackConfig *tc) - /* SamplingFrequency */ - if (mk_writeFloat(v, MATROSKA_ID_AUDIOSAMPLINGFREQ, tc->extra.audio.samplingFreq) < 0) - return NULL; -+ if (tc->extra.audio.outputSamplingFreq) { -+ /* Output SamplingFrequency */ -+ if (mk_writeFloat(v, MATROSKA_ID_AUDIOOUTSAMPLINGFREQ, tc->extra.audio.outputSamplingFreq) < 0) -+ return NULL; -+ } - /* Channels */ - if (mk_writeUInt(v, MATROSKA_ID_AUDIOCHANNELS, tc->extra.audio.channels) < 0) - return NULL; diff --git a/pkgs/development/libraries/libmkv/P00-mingw-large-file.patch b/pkgs/development/libraries/libmkv/P00-mingw-large-file.patch deleted file mode 100644 index 6a83eacca83..00000000000 --- a/pkgs/development/libraries/libmkv/P00-mingw-large-file.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- libmkv.orig/src/matroska.c 2009-01-12 23:14:26.000000000 -0800 -+++ libmkv/src/matroska.c 2009-03-25 15:22:30.000000000 -0700 -@@ -27,6 +27,11 @@ - - #include - -+#if defined( __MINGW32__ ) -+#undef fseeko -+#define fseeko fseeko64 -+#endif -+ - #define RESERVED_SEEKHEAD 0x100 - /* 256 bytes should be enough room for our Seek entries. */ - #define RESERVED_CHAPTERS 0x800 -@@ -34,7 +39,7 @@ - - int mk_seekFile(mk_Writer *w, uint64_t pos) - { -- if (fseek(w->fp, pos, SEEK_SET)) -+ if (fseeko(w->fp, pos, SEEK_SET)) - return -1; - - w->f_pos = pos; - diff --git a/pkgs/development/libraries/libmkv/default.nix b/pkgs/development/libraries/libmkv/default.nix index ab451fcd5fd..48e710c208f 100644 --- a/pkgs/development/libraries/libmkv/default.nix +++ b/pkgs/development/libraries/libmkv/default.nix @@ -1,26 +1,19 @@ { stdenv, fetchgit, libtool, autoconf, automake }: stdenv.mkDerivation rec { - name = "libmkv-0.6.5.1p2"; - + name = "libmkv-${version}"; + version = "0.6.5.1"; + src = fetchgit { url = https://github.com/saintdev/libmkv.git; - rev = "refs/tags/0.6.5.1"; + rev = "refs/tags/${version}"; sha256 = "0pr9q7yprndl8d15ir7i7cznvmf1yqpvnsyivv763n6wryssq6dl"; }; nativeBuildInputs = [ libtool autoconf automake ]; - # TODO fix library version preConfigure = "sh bootstrap.sh"; - # From Handbrake - patches = [ - ./A01-hbmv-pgs.patch - ./A02-audio-out-sampling-freq.patch - ./P00-mingw-large-file.patch - ]; - meta = { homepage = https://github.com/saintdev/libmkv; license = stdenv.lib.licenses.gpl2; diff --git a/pkgs/development/libraries/mp4v2/A02-meaningful-4gb-warning.patch b/pkgs/development/libraries/mp4v2/A02-meaningful-4gb-warning.patch deleted file mode 100644 index 987298bd5b0..00000000000 --- a/pkgs/development/libraries/mp4v2/A02-meaningful-4gb-warning.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -Naur mp4v2-trunk-r355/src/mp4atom.cpp mp4v2-trunk-r355/src/mp4atom.cpp ---- mp4v2-trunk-r355/src/mp4atom.cpp 2012-02-21 19:40:03.000000000 +0100 -+++ mp4v2-trunk-r355/src/mp4atom.cpp 2012-02-21 19:36:38.000000000 +0100 -@@ -543,6 +543,10 @@ - m_pFile->SetPosition(m_start + 8); - m_pFile->WriteUInt64(m_size); - } else { -+ if (!(m_size <= (uint64_t)0xFFFFFFFF)) { -+ // Let the user know what the following assert is all about -+ fprintf(stderr, "MP4ERROR: File size exceeded 4 GB; output unplayable. Enable \"Large file size\" to fix it.\n"); -+ } - ASSERT(m_size <= (uint64_t)0xFFFFFFFF); - m_pFile->SetPosition(m_start); - m_pFile->WriteUInt32(m_size); diff --git a/pkgs/development/libraries/mp4v2/default.nix b/pkgs/development/libraries/mp4v2/default.nix index a5542ebb659..e55d9989bff 100644 --- a/pkgs/development/libraries/mp4v2/default.nix +++ b/pkgs/development/libraries/mp4v2/default.nix @@ -9,10 +9,6 @@ stdenv.mkDerivation rec { }; patches = [ - # From Handbrake - # mp4v2 doesn't seem to be actively maintained any more :-/ - ./A02-meaningful-4gb-warning.patch - (fetchurl { name = "gcc-7.patch"; url = "https://src.fedoraproject.org/cgit/rpms/libmp4v2.git/plain/"