summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorrathann <rathann@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-09-15 16:32:31 +0000
committerrathann <rathann@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-09-15 16:32:31 +0000
commita5e9a8d0cac5eb5a40ce9df6f1a635a779064233 (patch)
treed74cb41ebf3f8bff73345f2dd46cf7f4a40603f7 /libmpcodecs
parentd977c6e812ddb88f2a980d9ee13389836c81dae7 (diff)
downloadmpv-a5e9a8d0cac5eb5a40ce9df6f1a635a779064233.tar.bz2
mpv-a5e9a8d0cac5eb5a40ce9df6f1a635a779064233.tar.xz
External liba52 support, part 2 of 2.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27620 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_hwac3.c6
-rw-r--r--libmpcodecs/ad_liba52.c19
2 files changed, 25 insertions, 0 deletions
diff --git a/libmpcodecs/ad_hwac3.c b/libmpcodecs/ad_hwac3.c
index 0cb480ddfd..1757018796 100644
--- a/libmpcodecs/ad_hwac3.c
+++ b/libmpcodecs/ad_hwac3.c
@@ -17,7 +17,11 @@
#include "ad_internal.h"
+#ifdef CONFIG_LIBA52_INTERNAL
#include "liba52/a52.h"
+#else
+#include <a52dec/a52.h>
+#endif
static int isdts = -1;
@@ -97,8 +101,10 @@ static int ac3dts_fillbuff(sh_audio_t *sh_audio)
sh_audio->a_in_buffer_len = length;
// TODO: is DTS also checksummed?
+#ifdef CONFIG_LIBA52_INTERNAL
if(isdts == 0 && crc16_block(sh_audio->a_in_buffer + 2, length - 2) != 0)
mp_msg(MSGT_DECAUDIO, MSGL_STATUS, "a52: CRC check failed! \n");
+#endif
return length;
}
diff --git a/libmpcodecs/ad_liba52.c b/libmpcodecs/ad_liba52.c
index 0a20e82cb2..d886ad6a6a 100644
--- a/libmpcodecs/ad_liba52.c
+++ b/libmpcodecs/ad_liba52.c
@@ -16,8 +16,14 @@
#include "libaf/af_format.h"
+#ifdef CONFIG_LIBA52_INTERNAL
#include "liba52/a52.h"
#include "liba52/mm_accel.h"
+#else
+#include <a52dec/a52.h>
+#include <a52dec/mm_accel.h>
+int (* a52_resample) (float * _f, int16_t * s16);
+#endif
static a52_state_t *a52_state;
static uint32_t a52_flags=0;
@@ -79,8 +85,10 @@ while(1){
if(sh_audio->format!=0x2000)
swab(sh_audio->a_in_buffer+8,sh_audio->a_in_buffer+8,length-8);
+#ifdef CONFIG_LIBA52_INTERNAL
if(crc16_block(sh_audio->a_in_buffer+2,length-2)!=0)
mp_msg(MSGT_DECAUDIO,MSGL_STATUS,"a52: CRC check failed! \n");
+#endif
return length;
}
@@ -121,7 +129,11 @@ static int preinit(sh_audio_t *sh)
{
/* Dolby AC3 audio: */
/* however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */
+#ifdef CONFIG_LIBA52_INTERNAL
if (sh->samplesize < 2) sh->samplesize = 2;
+#else
+ if (sh->samplesize < 4) sh->samplesize = 4;
+#endif
sh->audio_out_minsize=audio_output_channels*sh->samplesize*256*6;
sh->audio_in_minsize=3840;
a52_level = 1.0;
@@ -175,6 +187,9 @@ static int init(sh_audio_t *sh_audio)
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"A52 init failed\n");
return 0;
}
+#ifndef CONFIG_LIBA52_INTERNAL
+ sh_audio->sample_format = AF_FORMAT_FLOAT_NE;
+#endif
if(a52_fillbuff(sh_audio)<0){
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"A52 sync failed\n");
return 0;
@@ -247,8 +262,12 @@ while(sh_audio->channels>0){
break;
}
} else
+#ifdef CONFIG_LIBA52_INTERNAL
if(a52_resample_init(a52_accel,flags,sh_audio->channels)) break;
--sh_audio->channels; /* try to decrease no. of channels*/
+#else
+ break;
+#endif
}
if(sh_audio->channels<=0){
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"a52: no resampler. try different channel setup!\n");