diff options
author | jstebbins <[email protected]> | 2012-07-15 19:47:01 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2012-07-15 19:47:01 +0000 |
commit | 10e3e70a28305f08eb5298c46e26eb6537ea08c8 (patch) | |
tree | e95b56f75297082db3a6719d4d0ef337c2f46a56 | |
parent | 62cbe39e294565f429411d8293aa64c41a9d1b30 (diff) |
Use libav for dts audio decoding instead of libdca
libdca has no advantage over libav for dts audio decoding. It doesn't do
drc and it's downmix capabilities are actually inferior to libav. So this
completely removes libdca from libhb
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4844 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | contrib/libdca/A00-general.patch | 834 | ||||
-rw-r--r-- | contrib/libdca/module.defs | 7 | ||||
-rw-r--r-- | contrib/libdca/module.rules | 2 | ||||
-rw-r--r-- | gtk/src/Makefile.am | 4 | ||||
-rw-r--r-- | libhb/bd.c | 5 | ||||
-rw-r--r-- | libhb/common.h | 2 | ||||
-rw-r--r-- | libhb/decdca.c | 432 | ||||
-rw-r--r-- | libhb/dvd.c | 1 | ||||
-rw-r--r-- | libhb/dvdnav.c | 1 | ||||
-rw-r--r-- | libhb/hb.c | 2 | ||||
-rw-r--r-- | libhb/internal.h | 1 | ||||
-rw-r--r-- | libhb/module.defs | 2 | ||||
-rw-r--r-- | libhb/scan.c | 1 | ||||
-rw-r--r-- | libhb/stream.c | 24 | ||||
-rw-r--r-- | libhb/work.c | 7 | ||||
-rw-r--r-- | macosx/HandBrake.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | make/include/main.defs | 1 | ||||
-rw-r--r-- | test/module.defs | 2 |
18 files changed, 22 insertions, 1312 deletions
diff --git a/contrib/libdca/A00-general.patch b/contrib/libdca/A00-general.patch deleted file mode 100644 index cab8db266..000000000 --- a/contrib/libdca/A00-general.patch +++ /dev/null @@ -1,834 +0,0 @@ -diff -Naur libdca/include/audio_out.h libdca_patched/include/audio_out.h ---- libdca/include/audio_out.h 2007-05-02 10:05:03.000000000 +0100 -+++ libdca_patched/include/audio_out.h 2007-05-02 10:09:42.000000000 +0100 -@@ -26,8 +26,8 @@ - - struct ao_instance_s { - int (* setup) (ao_instance_t * instance, int sample_rate, int * flags, -- level_t * level, sample_t * bias); -- int (* play) (ao_instance_t * instance, int flags, sample_t * samples); -+ dca_level_t * level, dca_sample_t * bias); -+ int (* play) (ao_instance_t * instance, int flags, dca_sample_t * samples); - void (* close) (ao_instance_t * instance); - }; - -diff -Naur libdca/include/dca.h libdca_patched/include/dca.h ---- libdca/include/dca.h 2007-05-02 10:05:03.000000000 +0100 -+++ libdca_patched/include/dca.h 2007-05-02 10:09:36.000000000 +0100 -@@ -32,14 +32,14 @@ - uint32_t mm_accel (void); - - #if defined(LIBDCA_FIXED) --typedef int32_t sample_t; --typedef int32_t level_t; -+typedef int32_t dca_sample_t; -+typedef int32_t dca_level_t; - #elif defined(LIBDCA_DOUBLE) --typedef double sample_t; --typedef double level_t; -+typedef double dca_sample_t; -+typedef double dca_level_t; - #else --typedef float sample_t; --typedef float level_t; -+typedef float dca_sample_t; -+typedef float dca_level_t; - #endif - - typedef struct dca_state_s dca_state_t; -@@ -65,21 +65,24 @@ - #define DCA_LFE 0x80 - #define DCA_ADJUST_LEVEL 0x100 - -+#define DCA_OUT_DPLI 0x200 -+#define DCA_OUT_DPLII 0x400 -+ - dca_state_t * dca_init (uint32_t mm_accel); - - int dca_syncinfo (dca_state_t *state, uint8_t * buf, int * flags, - int * sample_rate, int * bit_rate, int *frame_length); - - int dca_frame (dca_state_t * state, uint8_t * buf, int * flags, -- level_t * level, sample_t bias); -+ dca_level_t * level, dca_sample_t bias); - - void dca_dynrng (dca_state_t * state, -- level_t (* call) (level_t, void *), void * data); -+ dca_level_t (* call) (dca_level_t, void *), void * data); - - int dca_blocks_num (dca_state_t * state); - int dca_block (dca_state_t * state); - --sample_t * dca_samples (dca_state_t * state); -+dca_sample_t * dca_samples (dca_state_t * state); - - void dca_free (dca_state_t * state); - -diff -Naur libdca/libao/audio_out_aif.c libdca_patched/libao/audio_out_aif.c ---- libdca/libao/audio_out_aif.c 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/libao/audio_out_aif.c 2007-05-02 10:09:41.000000000 +0100 -@@ -49,7 +49,7 @@ - }; - - static int aif_setup (ao_instance_t * _instance, int sample_rate, int * flags, -- level_t * level, sample_t * bias) -+ dca_level_t * level, dca_sample_t * bias) - { - aif_instance_t * instance = (aif_instance_t *) _instance; - -@@ -78,7 +78,7 @@ - buf[1] = value; - } - --static int aif_play (ao_instance_t * _instance, int flags, sample_t * _samples) -+static int aif_play (ao_instance_t * _instance, int flags, dca_sample_t * _samples) - { - aif_instance_t * instance = (aif_instance_t *) _instance; - int16_t int16_samples[256*2]; -diff -Naur libdca/libao/audio_out_al.c libdca_patched/libao/audio_out_al.c ---- libdca/libao/audio_out_al.c 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/libao/audio_out_al.c 2007-05-02 10:09:41.000000000 +0100 -@@ -44,7 +44,7 @@ - } al_instance_t; - - static int al_setup (ao_instance_t * _instance, int sample_rate, int * flags, -- level_t * level, sample_t * bias) -+ dca_level_t * level, dca_sample_t * bias) - { - al_instance_t * instance = (al_instance_t *) _instance; - -@@ -59,7 +59,7 @@ - return 0; - } - --static int al_play (ao_instance_t * _instance, int flags, sample_t * _samples) -+static int al_play (ao_instance_t * _instance, int flags, dca_sample_t * _samples) - { - al_instance_t * instance = (al_instance_t *) _instance; - int16_t int16_samples[256*6]; -diff -Naur libdca/libao/audio_out_float.c libdca_patched/libao/audio_out_float.c ---- libdca/libao/audio_out_float.c 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/libao/audio_out_float.c 2007-05-02 10:09:40.000000000 +0100 -@@ -32,7 +32,7 @@ - #include "audio_out_internal.h" - - static int float_setup (ao_instance_t * instance, int sample_rate, int * flags, -- level_t * level, sample_t * bias) -+ dca_level_t * level, dca_sample_t * bias) - { - (void)instance; - (void)sample_rate; -@@ -44,7 +44,7 @@ - } - - static int float_play (ao_instance_t * instance, int flags, -- sample_t * _samples) -+ dca_sample_t * _samples) - { - #if defined(LIBDCA_FIXED) - float samples[256 * 2]; -diff -Naur libdca/libao/audio_out_internal.h libdca_patched/libao/audio_out_internal.h ---- libdca/libao/audio_out_internal.h 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/libao/audio_out_internal.h 2007-05-02 10:09:40.000000000 +0100 -@@ -25,7 +25,7 @@ - #ifdef LIBDCA_DOUBLE - typedef float convert_t; - #else --typedef sample_t convert_t; -+typedef dca_sample_t convert_t; - #endif - - #ifdef LIBDCA_FIXED -diff -Naur libdca/libao/audio_out_null.c libdca_patched/libao/audio_out_null.c ---- libdca/libao/audio_out_null.c 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/libao/audio_out_null.c 2007-05-02 10:09:39.000000000 +0100 -@@ -36,7 +36,7 @@ - } null_instance_t; - - static int null_setup (ao_instance_t * _instance, int sample_rate, int * flags, -- level_t * level, sample_t * bias) -+ dca_level_t * level, dca_sample_t * bias) - { - null_instance_t * instance = (null_instance_t *) _instance; - -@@ -48,7 +48,7 @@ - return 0; - } - --static int null_play (ao_instance_t * instance, int flags, sample_t * samples) -+static int null_play (ao_instance_t * instance, int flags, dca_sample_t * samples) - { - (void)instance; (void)flags; (void)samples; - return 0; -diff -Naur libdca/libao/audio_out_oss.c libdca_patched/libao/audio_out_oss.c ---- libdca/libao/audio_out_oss.c 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/libao/audio_out_oss.c 2007-05-02 10:09:38.000000000 +0100 -@@ -68,7 +68,7 @@ - } oss_instance_t; - - static int oss_setup (ao_instance_t * _instance, int sample_rate, int * flags, -- level_t * level, sample_t * bias) -+ dca_level_t * level, dca_sample_t * bias) - { - oss_instance_t * instance = (oss_instance_t *) _instance; - -@@ -83,7 +83,7 @@ - return 0; - } - --static int oss_play (ao_instance_t * _instance, int flags, sample_t * _samples) -+static int oss_play (ao_instance_t * _instance, int flags, dca_sample_t * _samples) - { - oss_instance_t * instance = (oss_instance_t *) _instance; - int16_t int16_samples[256*6]; -diff -Naur libdca/libao/audio_out_peak.c libdca_patched/libao/audio_out_peak.c ---- libdca/libao/audio_out_peak.c 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/libao/audio_out_peak.c 2007-05-02 10:09:38.000000000 +0100 -@@ -16,7 +16,7 @@ - } peak_instance_t; - - static int peak_setup (ao_instance_t * _instance, int sample_rate, int * flags, -- level_t * level, sample_t * bias) -+ dca_level_t * level, dca_sample_t * bias) - { - peak_instance_t * instance = (peak_instance_t *) _instance; - -@@ -29,7 +29,7 @@ - return 0; - } - --static int peak_play (ao_instance_t * _instance, int flags, sample_t * samples) -+static int peak_play (ao_instance_t * _instance, int flags, dca_sample_t * samples) - { - peak_instance_t * instance = (peak_instance_t *) _instance; - int i; -diff -Naur libdca/libao/audio_out_solaris.c libdca_patched/libao/audio_out_solaris.c ---- libdca/libao/audio_out_solaris.c 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/libao/audio_out_solaris.c 2007-05-02 10:09:37.000000000 +0100 -@@ -47,7 +47,7 @@ - } solaris_instance_t; - - static int solaris_setup (ao_instance_t * _instance, int sample_rate, -- int * flags, level_t * level, sample_t * bias) -+ int * flags, dca_level_t * level, dca_sample_t * bias) - { - solaris_instance_t * instance = (solaris_instance_t *) _instance; - -@@ -63,7 +63,7 @@ - } - - static int solaris_play (ao_instance_t * _instance, int flags, -- sample_t * _samples) -+ dca_sample_t * _samples) - { - solaris_instance_t * instance = (solaris_instance_t *) _instance; - int16_t int16_samples[256*2]; -diff -Naur libdca/libao/audio_out_wav.c libdca_patched/libao/audio_out_wav.c ---- libdca/libao/audio_out_wav.c 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/libao/audio_out_wav.c 2007-05-02 10:09:37.000000000 +0100 -@@ -87,7 +87,7 @@ - }; - - static int wav_setup (ao_instance_t * _instance, int sample_rate, int * flags, -- level_t * level, sample_t * bias) -+ dca_level_t * level, dca_sample_t * bias) - { - wav_instance_t * instance = (wav_instance_t *) _instance; - -@@ -157,7 +157,7 @@ - - #include <stdio.h> - --static int wav_play (ao_instance_t * _instance, int flags, sample_t * _samples) -+static int wav_play (ao_instance_t * _instance, int flags, dca_sample_t * _samples) - { - wav_instance_t * instance = (wav_instance_t *) _instance; - union -diff -Naur libdca/libao/audio_out_win.c libdca_patched/libao/audio_out_win.c ---- libdca/libao/audio_out_win.c 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/libao/audio_out_win.c 2007-05-02 10:09:36.000000000 +0100 -@@ -55,7 +55,7 @@ - } win_instance_t; - - static int win_setup (ao_instance_t * _instance, int sample_rate, int * flags, -- level_t * level, sample_t * bias) -+ dca_level_t * level, dca_sample_t * bias) - { - win_instance_t * instance = (win_instance_t *) _instance; - -@@ -70,7 +70,7 @@ - return 0; - } - --static int win_play (ao_instance_t * _instance, int flags, sample_t * _samples) -+static int win_play (ao_instance_t * _instance, int flags, dca_sample_t * _samples) - { - win_instance_t * instance = (win_instance_t *) _instance; - int current_buffer; -diff -Naur libdca/libdca/dca_internal.h libdca_patched/libdca/dca_internal.h ---- libdca/libdca/dca_internal.h 2007-05-02 10:05:05.000000000 +0100 -+++ libdca_patched/libdca/dca_internal.h 2007-05-02 10:09:35.000000000 +0100 -@@ -116,20 +116,20 @@ - double subband_fir_noidea[DCA_PRIM_CHANNELS_MAX][64]; - - /* Audio output */ -- level_t clev; /* centre channel mix level */ -- level_t slev; /* surround channels mix level */ -+ dca_level_t clev; /* centre channel mix level */ -+ dca_level_t slev; /* surround channels mix level */ - - int output; /* type of output */ -- level_t level; /* output level */ -- sample_t bias; /* output bias */ -+ dca_level_t level; /* output level */ -+ dca_sample_t bias; /* output bias */ - -- sample_t * samples; /* pointer to the internal audio samples buffer */ -+ dca_sample_t * samples; /* pointer to the internal audio samples buffer */ - int downmixed; - - int dynrnge; /* apply dynamic range */ -- level_t dynrng; /* dynamic range */ -+ dca_level_t dynrng; /* dynamic range */ - void * dynrngdata; /* dynamic range callback funtion and data */ -- level_t (* dynrngcall) (level_t range, void * dynrngdata); -+ dca_level_t (* dynrngcall) (dca_level_t range, void * dynrngdata); - - /* Bitstream handling */ - uint32_t * buffer_start; -@@ -155,19 +155,23 @@ - #define LEVEL_45DB 0.5946035575013605 - #define LEVEL_6DB 0.5 - --int dca_downmix_init (int input, int flags, level_t * level, -- level_t clev, level_t slev); --int dca_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, -- level_t clev, level_t slev); --void dca_downmix (sample_t * samples, int acmod, int output, sample_t bias, -- level_t clev, level_t slev); --void dca_upmix (sample_t * samples, int acmod, int output); -+// these next two constants are used for DPL matrix encoding in downmix.c -+#define LEVEL_SQRT_1_2 0.5 -+#define LEVEL_SQRT_3_4 0.8660254037844386 -+ -+int dca_downmix_init (int input, int flags, dca_level_t * level, -+ dca_level_t clev, dca_level_t slev); -+int dca_downmix_coeff (dca_level_t * coeff, int acmod, int output, dca_level_t level, -+ dca_level_t clev, dca_level_t slev); -+void dca_downmix (dca_sample_t * samples, int acmod, int output, dca_sample_t bias, -+ dca_level_t clev, dca_level_t slev); -+void dca_upmix (dca_sample_t * samples, int acmod, int output); - - #define ROUND(x) ((int)((x) + ((x) > 0 ? 0.5 : -0.5))) - - #ifndef LIBDCA_FIXED - --typedef sample_t quantizer_t; -+typedef dca_sample_t quantizer_t; - #define SAMPLE(x) (x) - #define LEVEL(x) (x) - #define MUL(a,b) ((a) * (b)) -@@ -179,8 +183,8 @@ - #else /* LIBDCA_FIXED */ - - typedef int16_t quantizer_t; --#define SAMPLE(x) (sample_t)((x) * (1 << 30)) --#define LEVEL(x) (level_t)((x) * (1 << 26)) -+#define SAMPLE(x) (dca_sample_t)((x) * (1 << 30)) -+#define LEVEL(x) (dca_level_t)((x) * (1 << 26)) - - #if 0 - #define MUL(a,b) ((int)(((int64_t)(a) * (b) + (1 << 29)) >> 30)) -diff -Naur libdca/libdca/downmix.c libdca_patched/libdca/downmix.c ---- libdca/libdca/downmix.c 2007-05-02 10:05:05.000000000 +0100 -+++ libdca_patched/libdca/downmix.c 2007-05-06 19:45:54.000000000 +0100 -@@ -33,8 +33,8 @@ - - #define CONVERT(acmod,output) (((output) << DCA_CHANNEL_BITS) + (acmod)) - --int dca_downmix_init (int input, int flags, level_t * level, -- level_t clev, level_t slev) -+int dca_downmix_init (int input, int flags, dca_level_t * level, -+ dca_level_t clev, dca_level_t slev) - { - static uint8_t table[11][10] = { - /* DCA_MONO */ -@@ -96,7 +96,7 @@ - output = DCA_DOLBY; - - if (flags & DCA_ADJUST_LEVEL) { -- level_t adjust; -+ dca_level_t adjust; - - switch (CONVERT (input & 7, output)) { - -@@ -181,13 +181,16 @@ - *level = MUL_L (*level, adjust); - } - -+ // add the DPLI/DPLII flag back into the output if one was passed in -+ output = output | (flags & DCA_OUT_DPLI) | (flags & DCA_OUT_DPLII); -+ - return output; - } - --int dca_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, -- level_t clev, level_t slev) -+int dca_downmix_coeff (dca_level_t * coeff, int acmod, int output, dca_level_t level, -+ dca_level_t clev, dca_level_t slev) - { -- level_t level_3db; -+ dca_level_t level_3db; - - level_3db = MUL_C (level, LEVEL_3DB); - -@@ -344,7 +347,7 @@ - return -1; /* NOTREACHED */ - } - --static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias) -+static void mix2to1 (dca_sample_t * dest, dca_sample_t * src, dca_sample_t bias) - { - int i; - -@@ -352,7 +355,7 @@ - dest[i] += BIAS (src[i]); - } - --static void mix3to1 (sample_t * samples, sample_t bias) -+static void mix3to1 (dca_sample_t * samples, dca_sample_t bias) - { - int i; - -@@ -360,7 +363,7 @@ - samples[i] += BIAS (samples[i + 256] + samples[i + 512]); - } - --static void mix4to1 (sample_t * samples, sample_t bias) -+static void mix4to1 (dca_sample_t * samples, dca_sample_t bias) - { - int i; - -@@ -369,7 +372,7 @@ - samples[i + 768]); - } - --static void mix5to1 (sample_t * samples, sample_t bias) -+static void mix5to1 (dca_sample_t * samples, dca_sample_t bias) - { - int i; - -@@ -378,10 +381,10 @@ - samples[i + 768] + samples[i + 1024]); - } - --static void mix3to2 (sample_t * samples, sample_t bias) -+static void mix3to2 (dca_sample_t * samples, dca_sample_t bias) - { - int i; -- sample_t common; -+ dca_sample_t common; - - for (i = 0; i < 256; i++) { - common = BIAS (samples[i]); -@@ -390,10 +393,10 @@ - } - } - --static void mix21to2 (sample_t * left, sample_t * right, sample_t bias) -+static void mix21to2 (dca_sample_t * left, dca_sample_t * right, dca_sample_t bias) - { - int i; -- sample_t common; -+ dca_sample_t common; - - for (i = 0; i < 256; i++) { - common = BIAS (right[i + 256]); -@@ -402,10 +405,10 @@ - } - } - --static void mix21toS (sample_t * samples, sample_t bias) -+static void mix21toS (dca_sample_t * samples, dca_sample_t bias) - { - int i; -- sample_t surround; -+ dca_sample_t surround; - - for (i = 0; i < 256; i++) { - surround = samples[i + 512]; -@@ -414,10 +417,10 @@ - } - } - --static void mix31to2 (sample_t * samples, sample_t bias) -+static void mix31to2 (dca_sample_t * samples, dca_sample_t bias) - { - int i; -- sample_t common; -+ dca_sample_t common; - - for (i = 0; i < 256; i++) { - common = BIAS (samples[i] + samples[i + 768]); -@@ -426,23 +429,32 @@ - } - } - --static void mix31toS (sample_t * samples, sample_t bias) -+static void mix31toS (dca_sample_t * samples, dca_sample_t bias) - { -- int i; -- sample_t common, surround; - -- for (i = 0; i < 256; i++) { -- common = BIAS (samples[i]); -- surround = samples[i + 768]; -- samples[i] = samples[i + 256] + common - surround; -- samples[i + 256] = samples[i + 512] + common + surround; -- } -+ int i; -+ dca_sample_t cc, surround, Lt, Rt; -+ -+ for (i = 0; i < 256; i++) { -+ -+ cc = samples[i] * LEVEL_3DB; -+ -+ surround = samples[i + 768]; -+ -+ Lt = samples[i + 256] + cc; -+ Rt = samples[i + 512] + cc; -+ -+ samples[i] = Lt - surround; -+ samples[i + 256] = Rt + surround; -+ -+ } -+ - } - --static void mix22toS (sample_t * samples, sample_t bias) -+static void mix22toS (dca_sample_t * samples, dca_sample_t bias) - { - int i; -- sample_t surround; -+ dca_sample_t surround; - - for (i = 0; i < 256; i++) { - surround = samples[i + 512] + samples[i + 768]; -@@ -451,10 +463,10 @@ - } - } - --static void mix32to2 (sample_t * samples, sample_t bias) -+static void mix32to2 (dca_sample_t * samples, dca_sample_t bias) - { - int i; -- sample_t common; -+ dca_sample_t common; - - for (i = 0; i < 256; i++) { - common = BIAS (samples[i]); -@@ -463,20 +475,55 @@ - } - } - --static void mix32toS (sample_t * samples, sample_t bias) -+static void mix32toS (dca_sample_t * samples, dca_sample_t bias, int use_dpl2) - { -- int i; -- sample_t common, surround; - -- for (i = 0; i < 256; i++) { -- common = BIAS (samples[i]); -- surround = samples[i + 768] + samples[i + 1024]; -- samples[i] = samples[i + 256] + common - surround; -- samples[i + 256] = samples[i + 512] + common + surround; -- } --} -+ if (use_dpl2 == 1) { - --static void move2to1 (sample_t * src, sample_t * dest, sample_t bias) -+ int i; -+ dca_sample_t cc, Lt, Rt, Ls, Rs, Lss, Rss; -+ -+ for (i = 0; i < 256; i++) { -+ -+ cc = samples[i] * LEVEL_3DB; -+ -+ Lt = samples[i + 256] + cc; -+ Rt = samples[i + 512] + cc; -+ -+ Ls = samples[i + 768]; -+ Rs = samples[i + 1024]; -+ -+ Lss = (LEVEL_SQRT_3_4 * Ls) - (LEVEL_SQRT_1_2 * Rs); -+ Rss = -(LEVEL_SQRT_1_2 * Ls) + (LEVEL_SQRT_3_4 * Rs); -+ -+ samples[i] = Lt + Lss; -+ samples[i + 256] = Rt + Rss; -+ -+ } -+ -+ } else { -+ -+ int i; -+ dca_sample_t cc, surround, Lt, Rt; -+ -+ for (i = 0; i < 256; i++) { -+ -+ cc = samples[i] * LEVEL_3DB; -+ -+ surround = samples[i + 768] + samples[i + 1024]; -+ -+ Lt = samples[i + 256] + cc; -+ Rt = samples[i + 512] + cc; -+ -+ samples[i] = Lt - surround; -+ samples[i + 256] = Rt + surround; -+ -+ } -+ -+ } -+ -+} -+static void move2to1 (dca_sample_t * src, dca_sample_t * dest, dca_sample_t bias) - { - int i; - -@@ -484,7 +531,7 @@ - dest[i] = BIAS (src[i] + src[i + 256]); - } - --static void zero (sample_t * samples) -+static void zero (dca_sample_t * samples) - { - int i; - -@@ -492,8 +539,8 @@ - samples[i] = 0; - } - --void dca_downmix (sample_t * samples, int acmod, int output, sample_t bias, -- level_t clev, level_t slev) -+void dca_downmix (dca_sample_t * samples, int acmod, int output, dca_sample_t bias, -+ dca_level_t clev, dca_level_t slev) - { - (void)clev; - -@@ -529,7 +576,7 @@ - break; - - case CONVERT (DCA_MONO, DCA_DOLBY): -- memcpy (samples + 256, samples, 256 * sizeof (sample_t)); -+ memcpy (samples + 256, samples, 256 * sizeof (dca_sample_t)); - break; - - case CONVERT (DCA_3F, DCA_STEREO): -@@ -576,7 +623,7 @@ - break; - - case CONVERT (DCA_3F2R, DCA_DOLBY): -- mix32toS (samples, bias); -+ mix32toS (samples, bias, 0); - break; - - case CONVERT (DCA_3F1R, DCA_3F): -@@ -594,7 +641,7 @@ - - case CONVERT (DCA_3F1R, DCA_2F1R): - mix3to2 (samples, bias); -- memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); -+ memcpy (samples + 512, samples + 768, 256 * sizeof (dca_sample_t)); - break; - - case CONVERT (DCA_2F2R, DCA_2F1R): -@@ -608,30 +655,52 @@ - - case CONVERT (DCA_3F2R, DCA_3F1R): - mix2to1 (samples + 768, samples + 1024, bias); -+ /* deal with the special-case 5.0 to 4.0 DPL mix */ -+ if (output & DCA_OUT_DPLI) -+ { -+ mix31toS (samples, bias); -+ } - break; - - case CONVERT (DCA_2F1R, DCA_2F2R): -- memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); -+ memcpy (samples + 768, samples + 512, 256 * sizeof (dca_sample_t)); - break; - - case CONVERT (DCA_3F1R, DCA_2F2R): - mix3to2 (samples, bias); -- memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); -+ memcpy (samples + 512, samples + 768, 256 * sizeof (dca_sample_t)); - break; - - case CONVERT (DCA_3F2R, DCA_2F2R): - mix3to2 (samples, bias); -- memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); -- memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t)); -+ memcpy (samples + 512, samples + 768, 256 * sizeof (dca_sample_t)); -+ memcpy (samples + 768, samples + 1024, 256 * sizeof (dca_sample_t)); - break; - - case CONVERT (DCA_3F1R, DCA_3F2R): -- memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); -+ memcpy (samples + 1024, samples + 768, 256 * sizeof (dca_sample_t)); -+ break; -+ -+ /* deal with the special-case DPL mixes */ -+ -+ case CONVERT (DCA_3F1R, DCA_3F1R): -+ if (output & DCA_OUT_DPLI) -+ { -+ mix31toS (samples, bias); -+ } - break; -+ -+ case CONVERT (DCA_3F2R, DCA_3F2R): -+ if (output & DCA_OUT_DPLII) -+ { -+ mix32toS (samples, bias, 1); -+ } -+ break; -+ - } - } - --void dca_upmix (sample_t * samples, int acmod, int output) -+void dca_upmix (dca_sample_t * samples, int acmod, int output) - { - switch (CONVERT (acmod, output & DCA_CHANNEL_MASK)) { - -@@ -657,7 +726,7 @@ - case CONVERT (DCA_3F, DCA_STEREO): - case CONVERT (DCA_3F, DCA_DOLBY): - mix_3to2: -- memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t)); -+ memcpy (samples + 512, samples + 256, 256 * sizeof (dca_sample_t)); - zero (samples + 256); - break; - -@@ -684,11 +753,11 @@ - zero (samples + 1024); - case CONVERT (DCA_3F1R, DCA_2F1R): - mix_31to21: -- memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); -+ memcpy (samples + 768, samples + 512, 256 * sizeof (dca_sample_t)); - goto mix_3to2; - - case CONVERT (DCA_3F2R, DCA_2F2R): -- memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); -+ memcpy (samples + 1024, samples + 768, 256 * sizeof (dca_sample_t)); - goto mix_31to21; - } - } -diff -Naur libdca/libdca/parse.c libdca_patched/libdca/parse.c ---- libdca/libdca/parse.c 2007-05-02 10:05:05.000000000 +0100 -+++ libdca_patched/libdca/parse.c 2007-05-02 10:09:33.000000000 +0100 -@@ -59,12 +59,12 @@ - static int decode_blockcode (int code, int levels, int *values); - - static void qmf_32_subbands (dca_state_t * state, int chans, -- double samples_in[32][8], sample_t *samples_out, -- double rScale, sample_t bias); -+ double samples_in[32][8], dca_sample_t *samples_out, -+ double rScale, dca_sample_t bias); - - static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample, -- double *samples_in, sample_t *samples_out, -- double rScale, sample_t bias ); -+ double *samples_in, dca_sample_t *samples_out, -+ double rScale, dca_sample_t bias ); - - static void pre_calc_cosmod( dca_state_t * state ); - -@@ -80,7 +80,7 @@ - - memset (state, 0, sizeof(dca_state_t)); - -- state->samples = (sample_t *) memalign (16, 256 * 12 * sizeof (sample_t)); -+ state->samples = (dca_sample_t *) memalign (16, 256 * 12 * sizeof (dca_sample_t)); - if (state->samples == NULL) { - free (state); - return NULL; -@@ -97,7 +97,7 @@ - return state; - } - --sample_t * dca_samples (dca_state_t * state) -+dca_sample_t * dca_samples (dca_state_t * state) - { - return state->samples; - } -@@ -207,7 +207,7 @@ - } - - int dca_frame (dca_state_t * state, uint8_t * buf, int * flags, -- level_t * level, sample_t bias) -+ dca_level_t * level, dca_sample_t bias) - { - int i, j; - static float adj_table[] = { 1.0, 1.1250, 1.2500, 1.4375 }; -@@ -996,7 +996,7 @@ - { - dca_upmix (state->samples, state->amode, state->output); - } else -- if (state->prim_channels > dca_channels[state->output & DCA_CHANNEL_MASK]) -+ if (state->prim_channels >= dca_channels[state->output & DCA_CHANNEL_MASK]) - { - dca_downmix (state->samples, state->amode, state->output, state->bias, - state->clev, state->slev); -@@ -1142,8 +1142,8 @@ - } - - static void qmf_32_subbands (dca_state_t * state, int chans, -- double samples_in[32][8], sample_t *samples_out, -- double scale, sample_t bias) -+ double samples_in[32][8], dca_sample_t *samples_out, -+ double scale, dca_sample_t bias) - { - double *prCoeff; - int i, j, k; -@@ -1224,8 +1224,8 @@ - } - - static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample, -- double *samples_in, sample_t *samples_out, -- double scale, sample_t bias) -+ double *samples_in, dca_sample_t *samples_out, -+ double scale, dca_sample_t bias) - { - /* samples_in: An array holding decimated samples. - * Samples in current subframe starts from samples_in[0], -@@ -1275,7 +1275,7 @@ - } - - void dca_dynrng (dca_state_t * state, -- level_t (* call) (level_t, void *), void * data) -+ dca_level_t (* call) (dca_level_t, void *), void * data) - { - state->dynrange = 0; - if (call) { -diff -Naur libdca/src/dcadec.c libdca_patched/src/dcadec.c ---- libdca/src/dcadec.c 2007-05-02 10:05:04.000000000 +0100 -+++ libdca_patched/src/dcadec.c 2007-05-02 10:09:35.000000000 +0100 -@@ -280,15 +280,15 @@ - } - bufpos = buf + length; - } else { -- level_t level; -- sample_t bias; -+ dca_level_t level; -+ dca_sample_t bias; - int i; - - if (output->setup (output, sample_rate, &flags, &level, &bias)) - goto error; - if (!disable_adjust) - flags |= DCA_ADJUST_LEVEL; -- level = (level_t) (level * gain); -+ level = (dca_level_t) (level * gain); - if (dca_frame (state, buf, &flags, &level, bias)) - goto error; - if (disable_dynrng) diff --git a/contrib/libdca/module.defs b/contrib/libdca/module.defs deleted file mode 100644 index 5a2de707a..000000000 --- a/contrib/libdca/module.defs +++ /dev/null @@ -1,7 +0,0 @@ -$(eval $(call import.MODULE.defs,LIBDCA,libdca)) -$(eval $(call import.CONTRIB.defs,LIBDCA)) - -LIBDCA.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libdca-r81-strapped.tar.gz -LIBDCA.EXTRACT.tarbase = libdca - -LIBDCA.CONFIGURE.bootstrap = rm -fr aclocal.m4 autom4te.cache; autoreconf -fiv; diff --git a/contrib/libdca/module.rules b/contrib/libdca/module.rules deleted file mode 100644 index 0f33e2185..000000000 --- a/contrib/libdca/module.rules +++ /dev/null @@ -1,2 +0,0 @@ -$(eval $(call import.MODULE.rules,LIBDCA)) -$(eval $(call import.CONTRIB.rules,LIBDCA)) diff --git a/gtk/src/Makefile.am b/gtk/src/Makefile.am index da65bc926..2a18ed70f 100644 --- a/gtk/src/Makefile.am +++ b/gtk/src/Makefile.am @@ -2,13 +2,13 @@ if MINGW HB_LIBS= \ - -lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil -ldca \ + -lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil \ -ldvdnav -ldvdread -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc \ -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheora -lz \ -lbz2 -liberty -lpthreadGC2 -lbluray -lass -lfontconfig -lfreetype else HB_LIBS= \ - -lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil -ldca \ + -lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil \ -ldvdnav -ldvdread -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc \ -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheora -lz \ -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype diff --git a/libhb/bd.c b/libhb/bd.c index a5dd53887..8ec0fcb49 100644 --- a/libhb/bd.c +++ b/libhb/bd.c @@ -426,7 +426,8 @@ hb_title_t * hb_bd_title_scan( hb_bd_t * d, int tt, uint64_t min_duration ) break; case BLURAY_STREAM_TYPE_AUDIO_DTS: - add_audio(ii, title->list_audio, bdaudio, 0, HB_ACODEC_DCA, 0); + add_audio(ii, title->list_audio, bdaudio, 0, HB_ACODEC_DCA, + CODEC_ID_DTS); break; case BLURAY_STREAM_TYPE_AUDIO_MPEG2: @@ -453,7 +454,7 @@ hb_title_t * hb_bd_title_scan( hb_bd_t * d, int tt, uint64_t min_duration ) case BLURAY_STREAM_TYPE_AUDIO_DTSHD: // Add 2 audio tracks. One for DTS-HD and one for DTS add_audio(ii, title->list_audio, bdaudio, HB_SUBSTREAM_BD_DTS, - HB_ACODEC_DCA, 0); + HB_ACODEC_DCA, CODEC_ID_DTS); // DTS-HD is special. The substreams must be concatinated // DTS-core followed by DTS-hd-extensions. Setting // a substream id of 0 says use all substreams. diff --git a/libhb/common.h b/libhb/common.h index 99aae30a1..eea705c1e 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -408,7 +408,7 @@ struct hb_job_s #define HB_ACODEC_DCA_HD 0x00040000 #define HB_ACODEC_MP3 0x00080000 #define HB_ACODEC_FFFLAC 0x00100000 -#define HB_ACODEC_FF_MASK 0x001f0000 +#define HB_ACODEC_FF_MASK 0x001f2000 #define HB_ACODEC_PASS_FLAG 0x40000000 #define HB_ACODEC_PASS_MASK (HB_ACODEC_MP3 | HB_ACODEC_FFAAC | HB_ACODEC_DCA_HD | HB_ACODEC_AC3 | HB_ACODEC_DCA) #define HB_ACODEC_AUTO_PASS (HB_ACODEC_PASS_MASK | HB_ACODEC_PASS_FLAG) diff --git a/libhb/decdca.c b/libhb/decdca.c deleted file mode 100644 index 17d0e7755..000000000 --- a/libhb/decdca.c +++ /dev/null @@ -1,432 +0,0 @@ -/* decdca.c - - Copyright (c) 2003-2012 HandBrake Team - This file is part of the HandBrake source code - Homepage: <http://handbrake.fr/>. - It may be used under the terms of the GNU General Public License v2. - For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html - */ - -#include "hb.h" -#include "audio_remap.h" - -#include "dca.h" - -struct hb_work_private_s -{ - hb_job_t * job; - - /* libdca handle */ - dca_state_t * state; - - double next_pts; - int64_t last_buf_pts; - int flags_in; - int flags_out; - int rate; - int bitrate; - int frame_length; - float level; - - int error; - int sync; - int size; - - /* max frame size of the 16 bits version is 16384 */ - /* max frame size of the 14 bits version is 18726 */ - uint8_t frame[18726]; - - hb_list_t * list; - - int out_discrete_channels; - -}; - -static int decdcaInit( hb_work_object_t *, hb_job_t * ); -static int decdcaWork( hb_work_object_t *, hb_buffer_t **, hb_buffer_t ** ); -static void decdcaClose( hb_work_object_t * ); -static int decdcaBSInfo( hb_work_object_t *, const hb_buffer_t *, - hb_work_info_t * ); - -hb_work_object_t hb_decdca = -{ - WORK_DECDCA, - "DCA decoder", - decdcaInit, - decdcaWork, - decdcaClose, - 0, - decdcaBSInfo -}; - -/*********************************************************************** - * Local prototypes - **********************************************************************/ -static hb_buffer_t * Decode( hb_work_object_t * w ); - -/*********************************************************************** - * hb_work_decdca_init - *********************************************************************** - * Allocate the work object, initialize libdca - **********************************************************************/ -static int decdcaInit( hb_work_object_t * w, hb_job_t * job ) -{ - hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) ); - hb_audio_t * audio = w->audio; - w->private_data = pv; - - pv->job = job; - - pv->list = hb_list_init(); - pv->state = dca_init( 0 ); - pv->level = 1.0; - - /* Decide what format we want out of libdca; - * work.c has already done some of this deduction for us in do_job(). - * Dolby Surround and Pro Logic II are a bit tricky. */ - int layout = (audio->config.in.channel_layout & ~AV_CH_LOW_FREQUENCY); - switch (audio->config.out.mixdown) - { - case HB_AMIXDOWN_6CH: - pv->flags_out = (DCA_3F2R|DCA_LFE); - break; - - case HB_AMIXDOWN_DOLBYPLII: - { - if (layout == AV_CH_LAYOUT_5POINT0) - { - // Dolby Pro Logic II output is supported - pv->flags_out = (DCA_3F2R|DCA_OUT_DPLII); - } - else if (layout == AV_CH_LAYOUT_4POINT0) - { - // Dolby Surround output and DCA_3F1R downmix are supported - pv->flags_out = (DCA_3F1R|DCA_OUT_DPLI); - } - else if (layout == AV_CH_LAYOUT_STEREO || - layout == AV_CH_LAYOUT_STEREO_DOWNMIX) - { - // Dolby Surround output not supported OR - // Dolby Surround input just gets passed through as is - pv->flags_out = DCA_STEREO; - } - else - { - // Dolby Surround output is supported, but DCA_3F1R downmix isn't - pv->flags_out = DCA_DOLBY; - } - } break; - - case HB_AMIXDOWN_DOLBY: - { - if (layout == AV_CH_LAYOUT_5POINT0 || layout == AV_CH_LAYOUT_4POINT0) - { - // Dolby Surround output and DCA_3F1R downmix are supported - pv->flags_out = (DCA_3F1R|DCA_OUT_DPLI); - } - else if (layout == AV_CH_LAYOUT_STEREO || - layout == AV_CH_LAYOUT_STEREO_DOWNMIX) - { - // Dolby Surround output not supported OR - // Dolby Surround input just gets passed through as is - pv->flags_out = DCA_STEREO; - } - else - { - // Dolby Surround output is supported, but DCA_3F1R downmix isn't - pv->flags_out = DCA_DOLBY; - } - } break; - - case HB_AMIXDOWN_MONO: - pv->flags_out = DCA_MONO; - break; - - default: - pv->flags_out = DCA_STEREO; - break; - } - - /* pass the number of channels used into the private work data */ - pv->out_discrete_channels = hb_mixdown_get_discrete_channel_count( audio->config.out.mixdown ); - - return 0; -} - -/*********************************************************************** - * Close - *********************************************************************** - * Free memory - **********************************************************************/ -static void decdcaClose( hb_work_object_t * w ) -{ - hb_work_private_t * pv = w->private_data; - dca_free( pv->state ); - hb_list_empty( &pv->list ); - free( pv ); - w->private_data = NULL; -} - -/*********************************************************************** - * Work - *********************************************************************** - * Add the given buffer to the data we already have, and decode as much - * as we can - **********************************************************************/ -static int decdcaWork( hb_work_object_t * w, hb_buffer_t ** buf_in, - hb_buffer_t ** buf_out ) -{ - hb_work_private_t * pv = w->private_data; - hb_buffer_t * buf; - - if ( (*buf_in)->size <= 0 ) - { - /* EOF on input stream - send it downstream & say that we're done */ - *buf_out = *buf_in; - *buf_in = NULL; - return HB_WORK_DONE; - } - - if ( (*buf_in)->s.start < -1 && pv->next_pts == 0 ) - { - // discard buffers that start before video time 0 - *buf_out = NULL; - return HB_WORK_OK; - } - - hb_list_add( pv->list, *buf_in ); - *buf_in = NULL; - - /* If we got more than a frame, chain raw buffers */ - *buf_out = buf = Decode( w ); - while( buf ) - { - buf->next = Decode( w ); - buf = buf->next; - } - - return HB_WORK_OK; -} - -/*********************************************************************** - * Decode - *********************************************************************** - * - **********************************************************************/ -static hb_buffer_t * Decode( hb_work_object_t * w ) -{ - hb_work_private_t * pv = w->private_data; - hb_buffer_t * buf; - hb_audio_t * audio = w->audio; - int i, j, k; - int64_t pts; - uint64_t upts, upos; - int num_blocks; - - /* Get a frame header if don't have one yet */ - if( !pv->sync ) - { - while( hb_list_bytes( pv->list ) >= 14 ) - { - /* We have 14 bytes, check if this is a correct header */ - hb_list_seebytes( pv->list, pv->frame, 14 ); - pv->size = dca_syncinfo( pv->state, pv->frame, &pv->flags_in, &pv->rate, - &pv->bitrate, &pv->frame_length ); - if( pv->size ) - { - /* It is. W00t. */ - if( pv->error ) - { - hb_log( "dca_syncinfo ok" ); - } - pv->error = 0; - pv->sync = 1; - break; - } - - /* It is not */ - if( !pv->error ) - { - hb_log( "dca_syncinfo failed" ); - pv->error = 1; - } - - /* Try one byte later */ - hb_list_getbytes( pv->list, pv->frame, 1, NULL, NULL ); - } - } - - if( !pv->sync || hb_list_bytes( pv->list ) < pv->size ) - { - /* Need more data */ - return NULL; - } - - /* Get the whole frame */ - hb_list_getbytes( pv->list, pv->frame, pv->size, &upts, &upos ); - pts = (int64_t)upts; - - if ( pts != pv->last_buf_pts ) - { - pv->last_buf_pts = pts; - } - else - { - // spec says that the PTS is the start time of the first frame - // that starts in the PES frame so we only use the PTS once then - // get the following frames' PTS from the frame length. - pts = -1; - } - - // mkv files typically use a 1ms timebase which results in a lot of - // truncation error in their timestamps. Also, TSMuxer or something - // in the m2ts-to-mkv toolchain seems to take a very casual attitude - // about time - timestamps seem to randomly offset by ~40ms for a few - // seconds then recover. So, if the pts we got is within 50ms of the - // pts computed from the data stream, use the data stream pts. - if ( pts == -1 || ( pv->next_pts && fabs( pts - pv->next_pts ) < 50.*90. ) ) - { - pts = pv->next_pts; - } - - double frame_dur = (double)(pv->frame_length & ~0xFF) / (double)pv->rate * 90000.; - - /* DCA passthrough: don't decode the DCA frame */ - if( audio->config.out.codec == HB_ACODEC_DCA_PASS ) - { - buf = hb_buffer_init( pv->size ); - memcpy( buf->data, pv->frame, pv->size ); - buf->s.start = pts; - buf->s.duration = frame_dur; - pv->next_pts = pts + frame_dur; - buf->s.stop = pv->next_pts; - pv->sync = 0; - return buf; - } - - /* Feed libdca */ - dca_frame( pv->state, pv->frame, &pv->flags_out, &pv->level, 0 ); - - /* find out how many blocks are in this frame */ - num_blocks = dca_blocks_num( pv->state ); - - /* num_blocks blocks per frame, 256 samples per block, channelsused channels */ - int nsamp = num_blocks * 256; - frame_dur = (double)nsamp / (double)pv->rate * 90000.; - buf = hb_buffer_init( nsamp * pv->out_discrete_channels * sizeof( float ) ); - - buf->s.start = pts; - buf->s.duration = frame_dur; - pv->next_pts = pts + frame_dur; - buf->s.stop = pv->next_pts; - - for( i = 0; i < num_blocks; i++ ) - { - dca_sample_t * samples_in; - float * samples_out; - - dca_block( pv->state ); - samples_in = dca_samples( pv->state ); - samples_out = ((float *) buf->data) + 256 * pv->out_discrete_channels * i; - - /* Interleave */ - for( j = 0; j < 256; j++ ) - { - for ( k = 0; k < pv->out_discrete_channels; k++ ) - { - samples_out[(pv->out_discrete_channels*j)+k] = samples_in[(256*k)+j]; - } - } - - } - - pv->sync = 0; - return buf; -} - - -static int decdcaBSInfo( hb_work_object_t *w, const hb_buffer_t *b, - hb_work_info_t *info ) -{ - int i, flags, rate, bitrate, frame_length; - dca_state_t * state = dca_init( 0 ); - - memset( info, 0, sizeof(*info) ); - - /* since DCA frames don't line up with MPEG ES frames scan the - * entire frame for an DCA sync pattern. */ - for ( i = 0; i < b->size - 7; ++i ) - { - if( dca_syncinfo( state, &b->data[i], &flags, &rate, &bitrate, - &frame_length ) ) - { - break; - } - } - if ( i >= b->size - 7 ) - { - /* didn't find DCA sync */ - dca_free( state ); - return 0; - } - - info->name = "DCA"; - info->rate = rate; - info->rate_base = 1; - info->bitrate = bitrate; - info->flags = flags; - info->samples_per_frame = frame_length; - - switch( flags & DCA_CHANNEL_MASK ) - { - /* mono sources */ - case DCA_MONO: - info->channel_layout = AV_CH_LAYOUT_MONO; - break; - /* stereo input */ - case DCA_CHANNEL: - case DCA_STEREO: - case DCA_STEREO_SUMDIFF: - case DCA_STEREO_TOTAL: - info->channel_layout = AV_CH_LAYOUT_STEREO; - break; - /* Dolby Pro Logic (a.k.a. Dolby Surround), 4.0 channels (matrix-encoded) */ - case DCA_DOLBY: - info->channel_layout = AV_CH_LAYOUT_STEREO_DOWNMIX; - break; - /* 3F/2R input */ - case DCA_3F2R: - info->channel_layout = AV_CH_LAYOUT_5POINT0; - break; - /* 3F/1R input */ - case DCA_3F1R: - info->channel_layout = AV_CH_LAYOUT_4POINT0; - break; - /* other inputs */ - case DCA_3F: - info->channel_layout = AV_CH_LAYOUT_SURROUND; - break; - case DCA_2F1R: - info->channel_layout = AV_CH_LAYOUT_2_1; - break; - case DCA_2F2R: - info->channel_layout = AV_CH_LAYOUT_2_2; - break; - case DCA_4F2R: - info->channel_layout = AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER; - break; - /* unknown */ - default: - info->channel_layout = AV_CH_LAYOUT_STEREO; - } - - if (flags & DCA_LFE) - { - info->channel_layout |= AV_CH_LOW_FREQUENCY; - } - - info->channel_map = &hb_libdca_chan_map; - - dca_free( state ); - return 1; -} diff --git a/libhb/dvd.c b/libhb/dvd.c index 6af2e7908..df0fd1829 100644 --- a/libhb/dvd.c +++ b/libhb/dvd.c @@ -376,6 +376,7 @@ static hb_title_t * hb_dvdread_title_scan( hb_dvd_t * e, int t, uint64_t min_dur case 0x06: audio->id = ( ( 0x88 + position ) << 8 ) | 0xbd; audio->config.in.codec = HB_ACODEC_DCA; + audio->config.in.codec_param = CODEC_ID_DTS; codec_name = "DTS"; break; diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c index d6e97c1a5..436147a4d 100644 --- a/libhb/dvdnav.c +++ b/libhb/dvdnav.c @@ -525,6 +525,7 @@ static hb_title_t * hb_dvdnav_title_scan( hb_dvd_t * e, int t, uint64_t min_dura case 0x06: audio->id = ( ( 0x88 + position ) << 8 ) | 0xbd; audio->config.in.codec = HB_ACODEC_DCA; + audio->config.in.codec_param = CODEC_ID_DTS; codec_name = "DTS"; break; diff --git a/libhb/hb.c b/libhb/hb.c index c6b569caf..ef3f15edf 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -448,7 +448,6 @@ hb_handle_t * hb_init( int verbose, int update_check ) hb_register( &hb_encx264 ); hb_register( &hb_enctheora ); hb_register( &hb_deca52 ); - hb_register( &hb_decdca ); hb_register( &hb_decavcodeca ); hb_register( &hb_decavcodecv ); hb_register( &hb_declpcm ); @@ -547,7 +546,6 @@ hb_handle_t * hb_init_dl( int verbose, int update_check ) hb_register( &hb_encx264 ); hb_register( &hb_enctheora ); hb_register( &hb_deca52 ); - hb_register( &hb_decdca ); hb_register( &hb_decavcodeca ); hb_register( &hb_decavcodecv ); hb_register( &hb_declpcm ); diff --git a/libhb/internal.h b/libhb/internal.h index 577f6671e..9ca207d60 100644 --- a/libhb/internal.h +++ b/libhb/internal.h @@ -406,7 +406,6 @@ enum WORK_ENCX264, WORK_ENCTHEORA, WORK_DECA52, - WORK_DECDCA, WORK_DECAVCODEC, WORK_DECAVCODECV, WORK_DECLPCM, diff --git a/libhb/module.defs b/libhb/module.defs index 63acb9b9d..022d30621 100644 --- a/libhb/module.defs +++ b/libhb/module.defs @@ -92,7 +92,7 @@ LIBHB.dll = $(LIBHB.build/)hb.dll LIBHB.lib = $(LIBHB.build/)hb.lib LIBHB.dll.libs = $(foreach n, \ - a52 ass avcodec avformat avutil avresample dca dvdnav dvdread faac fontconfig freetype mkv mpeg2 mp3lame mp4v2 \ + a52 ass avcodec avformat avutil avresample dvdnav dvdread faac fontconfig freetype mkv mpeg2 mp3lame mp4v2 \ ogg samplerate swscale theora vorbis vorbisenc x264 xml2 bluray, \ $(CONTRIB.build/)lib/lib$(n).a ) diff --git a/libhb/scan.c b/libhb/scan.c index 4776e08c4..10ed35391 100644 --- a/libhb/scan.c +++ b/libhb/scan.c @@ -10,7 +10,6 @@ #include "hb.h" #include "hbffmpeg.h" #include "a52dec/a52.h" -#include "dca.h" typedef struct { diff --git a/libhb/stream.c b/libhb/stream.c index 4c9cb347c..27e753f0f 100644 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -73,7 +73,7 @@ static const stream2codec_t st2codec[256] = { st(0x80, U, HB_ACODEC_FFMPEG, CODEC_ID_PCM_BLURAY, "Digicipher II Video"), st(0x81, A, HB_ACODEC_AC3, 0, "AC3"), - st(0x82, A, HB_ACODEC_DCA, 0, "DTS"), + st(0x82, A, HB_ACODEC_DCA, CODEC_ID_DTS, "DTS"), // 0x83 can be LPCM or BD TrueHD. Set to 'unknown' till we know more. st(0x83, U, HB_ACODEC_LPCM, 0, "LPCM"), // BD E-AC3 Primary audio @@ -83,7 +83,7 @@ static const stream2codec_t st2codec[256] = { st(0x86, U, HB_ACODEC_DCA_HD, CODEC_ID_DTS, "DTS-HD MA"), st(0x87, A, HB_ACODEC_FFMPEG, CODEC_ID_EAC3, "E-AC3"), - st(0x8a, A, HB_ACODEC_DCA, 0, "DTS"), + st(0x8a, A, HB_ACODEC_DCA, CODEC_ID_DTS, "DTS"), st(0x90, S, WORK_DECPGSSUB, 0, "PGS Subtitle"), // 0x91 can be AC3 or BD Interactive Graphics Stream. @@ -4067,8 +4067,6 @@ static int probe_dts_profile( hb_pes_stream_t *pes ) } switch (info.profile) { - /* When we improve handling of channels > 5.1, we should move - * DTS_ES down to use libav for decode */ case FF_PROFILE_DTS: case FF_PROFILE_DTS_ES: case FF_PROFILE_DTS_96_24: @@ -4306,6 +4304,7 @@ static void hb_ts_resolve_pid_types(hb_stream_t *stream) update_ts_streams( stream, pid, HB_SUBSTREAM_BD_DTS, stype, A, &pes_idx ); stream->pes.list[pes_idx].codec = HB_ACODEC_DCA; + stream->pes.list[pes_idx].codec_param = CODEC_ID_DTS; update_ts_streams( stream, pid, 0, stype, A, &pes_idx ); stream->pes.list[pes_idx].codec = HB_ACODEC_DCA_HD; @@ -4320,6 +4319,7 @@ static void hb_ts_resolve_pid_types(hb_stream_t *stream) update_ts_streams( stream, pid, HB_SUBSTREAM_BD_DTS, stype, A, &pes_idx ); stream->pes.list[pes_idx].codec = HB_ACODEC_DCA; + stream->pes.list[pes_idx].codec_param = CODEC_ID_DTS; update_ts_streams( stream, pid, 0, stype, A, &pes_idx ); stream->pes.list[pes_idx].codec = HB_ACODEC_DCA_HD; @@ -5116,18 +5116,16 @@ static void add_ffmpeg_audio( hb_title_t *title, hb_stream_t *stream, int id ) { audio->config.in.codec = HB_ACODEC_AC3; } - /* When we improve handling of channels > 5.1, we should move - * DTS_ES down to use libav for decode */ - else if ( codec->codec_id == CODEC_ID_DTS && - ( codec->profile == FF_PROFILE_DTS || - codec->profile == FF_PROFILE_DTS_ES || - codec->profile == FF_PROFILE_DTS_96_24 ) ) - { - audio->config.in.codec = HB_ACODEC_DCA; - } else { if ( codec->codec_id == CODEC_ID_DTS && + ( codec->profile == FF_PROFILE_DTS || + codec->profile == FF_PROFILE_DTS_ES || + codec->profile == FF_PROFILE_DTS_96_24 ) ) + { + audio->config.in.codec = HB_ACODEC_DCA; + } + else if ( codec->codec_id == CODEC_ID_DTS && ( codec->profile == FF_PROFILE_DTS_HD_MA || codec->profile == FF_PROFILE_DTS_HD_HRA ) ) { diff --git a/libhb/work.c b/libhb/work.c index 62d63ee3b..f0e128b92 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -9,7 +9,6 @@ #include "hb.h" #include "a52dec/a52.h" -#include "dca.h" #include "libavformat/avformat.h" typedef struct @@ -117,7 +116,6 @@ hb_work_object_t * hb_codec_decoder( int codec ) switch( codec ) { case HB_ACODEC_AC3: return hb_get_work( WORK_DECA52 ); - case HB_ACODEC_DCA: return hb_get_work( WORK_DECDCA ); case HB_ACODEC_LPCM: return hb_get_work( WORK_DECLPCM ); default: if ( codec & HB_ACODEC_FF_MASK ) @@ -438,10 +436,7 @@ void hb_display_job_info( hb_job_t * job ) hb_log( " + decoder: %s (track %d, id 0x%x)", audio->config.lang.description, audio->config.in.track + 1, audio->id ); - if( ( audio->config.in.codec == HB_ACODEC_AC3 ) || ( audio->config.in.codec == HB_ACODEC_DCA) ) - { - hb_log( " + bitrate: %d kbps, samplerate: %d Hz", audio->config.in.bitrate / 1000, audio->config.in.samplerate ); - } + hb_log( " + bitrate: %d kbps, samplerate: %d Hz", audio->config.in.bitrate / 1000, audio->config.in.samplerate ); if( audio->config.out.codec & HB_ACODEC_PASS_FLAG ) { diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index a15584b30..5c22284c7 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -102,8 +102,6 @@ 27D6C74A14B102DA00B785E4 /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72B14B102DA00B785E4 /* libavutil.a */; }; 27D6C74B14B102DA00B785E4 /* libbluray.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72C14B102DA00B785E4 /* libbluray.a */; }; 27D6C74C14B102DA00B785E4 /* libbluray.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72C14B102DA00B785E4 /* libbluray.a */; }; - 27D6C74D14B102DA00B785E4 /* libdca.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72D14B102DA00B785E4 /* libdca.a */; }; - 27D6C74E14B102DA00B785E4 /* libdca.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72D14B102DA00B785E4 /* libdca.a */; }; 27D6C74F14B102DA00B785E4 /* libdvdnav.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72E14B102DA00B785E4 /* libdvdnav.a */; }; 27D6C75014B102DA00B785E4 /* libdvdnav.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72E14B102DA00B785E4 /* libdvdnav.a */; }; 27D6C75114B102DA00B785E4 /* libdvdread.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72F14B102DA00B785E4 /* libdvdread.a */; }; @@ -293,7 +291,6 @@ 226268DF1572CC7300477B4E /* libavresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavresample.a; path = external/contrib/lib/libavresample.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27D6C72B14B102DA00B785E4 /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = external/contrib/lib/libavutil.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27D6C72C14B102DA00B785E4 /* libbluray.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbluray.a; path = external/contrib/lib/libbluray.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 27D6C72D14B102DA00B785E4 /* libdca.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdca.a; path = external/contrib/lib/libdca.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27D6C72E14B102DA00B785E4 /* libdvdnav.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdvdnav.a; path = external/contrib/lib/libdvdnav.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27D6C72F14B102DA00B785E4 /* libdvdread.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdvdread.a; path = external/contrib/lib/libdvdread.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27D6C73014B102DA00B785E4 /* libfaac.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfaac.a; path = external/contrib/lib/libfaac.a; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -334,7 +331,6 @@ 226268E11572CC7300477B4E /* libavresample.a in Frameworks */, 27D6C74A14B102DA00B785E4 /* libavutil.a in Frameworks */, 27D6C74C14B102DA00B785E4 /* libbluray.a in Frameworks */, - 27D6C74E14B102DA00B785E4 /* libdca.a in Frameworks */, 27D6C75014B102DA00B785E4 /* libdvdnav.a in Frameworks */, 27D6C75214B102DA00B785E4 /* libdvdread.a in Frameworks */, 27D6C75414B102DA00B785E4 /* libfaac.a in Frameworks */, @@ -377,7 +373,6 @@ 226268E01572CC7300477B4E /* libavresample.a in Frameworks */, 27D6C74914B102DA00B785E4 /* libavutil.a in Frameworks */, 27D6C74B14B102DA00B785E4 /* libbluray.a in Frameworks */, - 27D6C74D14B102DA00B785E4 /* libdca.a in Frameworks */, 27D6C74F14B102DA00B785E4 /* libdvdnav.a in Frameworks */, 27D6C75114B102DA00B785E4 /* libdvdread.a in Frameworks */, 27D6C75314B102DA00B785E4 /* libfaac.a in Frameworks */, @@ -413,7 +408,6 @@ 226268DF1572CC7300477B4E /* libavresample.a */, 27D6C72B14B102DA00B785E4 /* libavutil.a */, 27D6C72C14B102DA00B785E4 /* libbluray.a */, - 27D6C72D14B102DA00B785E4 /* libdca.a */, 27D6C72E14B102DA00B785E4 /* libdvdnav.a */, 27D6C72F14B102DA00B785E4 /* libdvdread.a */, 27D6C73014B102DA00B785E4 /* libfaac.a */, diff --git a/make/include/main.defs b/make/include/main.defs index a210ececf..df81a0fda 100644 --- a/make/include/main.defs +++ b/make/include/main.defs @@ -27,7 +27,6 @@ MODULES += contrib/fontconfig MODULES += contrib/freetype MODULES += contrib/lame MODULES += contrib/libass -MODULES += contrib/libdca MODULES += contrib/libdvdread MODULES += contrib/libdvdnav MODULES += contrib/libbluray diff --git a/test/module.defs b/test/module.defs index 45f6fea82..984fe7a08 100644 --- a/test/module.defs +++ b/test/module.defs @@ -10,7 +10,7 @@ TEST.c.o = $(patsubst $(SRC/)%.c,$(BUILD/)%.o,$(TEST.c)) TEST.exe = $(BUILD/)$(call TARGET.exe,$(HB.name)CLI) TEST.libs = $(LIBHB.a) $(foreach n, \ - a52 ass avcodec avformat avutil avresample dca dvdnav dvdread faac fontconfig freetype mkv mpeg2 mp3lame mp4v2 \ + a52 ass avcodec avformat avutil avresample dvdnav dvdread faac fontconfig freetype mkv mpeg2 mp3lame mp4v2 \ ogg samplerate swscale theora vorbis vorbisenc x264 xml2 bluray, \ $(CONTRIB.build/)lib/lib$(n).a ) |