Index: libmpcodecs/ad_hwac3.c =================================================================== --- libmpcodecs/ad_hwac3.c (revision 30264) +++ libmpcodecs/ad_hwac3.c (working copy) @@ -17,14 +17,10 @@ #include "mpbswap.h" #include "ad_internal.h" +#include "libavutil/internal.h" +#include "libavcodec/get_bits.h" +#include "libavcodec/ac3_parser.h" -#ifdef CONFIG_LIBA52_INTERNAL -#include "liba52/a52.h" -#else -#include -#endif - - static int isdts = -1; static ad_info_t info = @@ -79,7 +75,15 @@ } else { - length = a52_syncinfo(sh_audio->a_in_buffer, &flags, &sample_rate, &bit_rate); + GetBitContext gbc; AC3HeaderInfo hdr; + init_get_bits(&gbc, sh_audio->a_in_buffer, sh_audio->a_in_buffer_len * 8); + memset(&hdr, 0, sizeof hdr); + if (!ff_ac3_parse_header(&gbc, &hdr)) + { + length = hdr.frame_size; + sample_rate = hdr.sample_rate; + bit_rate = hdr.bit_rate; + } if(length >= 7 && length <= 3840) { if(isdts != 0) @@ -100,13 +104,6 @@ sh_audio->i_bps = bit_rate / 8; demux_read_data(sh_audio->ds, sh_audio->a_in_buffer + 12, length - 12); 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; } @@ -125,25 +122,16 @@ static int init(sh_audio_t *sh_audio) { /* Dolby AC3 passthrough:*/ - a52_state_t *a52_state = a52_init(0); - if(a52_state == NULL) - { - mp_msg(MSGT_DECAUDIO, MSGL_ERR, "A52 init failed\n"); - return 0; - } if(ac3dts_fillbuff(sh_audio) < 0) { - a52_free(a52_state); mp_msg(MSGT_DECAUDIO, MSGL_ERR, "AC3/DTS sync failed\n"); return 0; } - sh_audio->context = a52_state; return 1; } static void uninit(sh_audio_t *sh) { - a52_free(sh->context); } static int control(sh_audio_t *sh,int cmd,void* arg, ...)