summaryrefslogtreecommitdiff
path: root/src/libxineadec/xine_a52_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libxineadec/xine_a52_decoder.c')
-rw-r--r--src/libxineadec/xine_a52_decoder.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libxineadec/xine_a52_decoder.c b/src/libxineadec/xine_a52_decoder.c
index 2d901d00a..c3fa5fa7a 100644
--- a/src/libxineadec/xine_a52_decoder.c
+++ b/src/libxineadec/xine_a52_decoder.c
@@ -62,7 +62,8 @@
#include "buffer.h"
#include "xineutils.h"
-#include "../../contrib/a52dec/crc.c"
+/* libavutil from FFmpeg */
+#include <crc.h>
#undef DEBUG_A52
#ifdef DEBUG_A52
@@ -420,8 +421,6 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
uint8_t *end = buf->content + buf->size;
uint8_t byte;
int32_t n;
- uint16_t crc16;
- uint16_t crc16_result;
lprintf ("decode data %d bytes of type %08x, pts=%"PRId64"\n",
buf->size, buf->type, buf->pts);
@@ -587,10 +586,11 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
this->sync_state = 3;
} else break;
- case 3: /* Ready for decode */
- crc16 = (uint16_t) ((this->frame_buffer[2] << 8) | this->frame_buffer[3]) ;
- crc16_result = crc16_block(&this->frame_buffer[2], this->frame_length - 2) ; /* frame_length */
- if (crc16_result != 0) { /* CRC16 failed */
+ case 3: { /* Ready for decode */
+ if ( ! *av_crc8005 )
+ av_crc_init(av_crc8005, 0, 16, AV_CRC_16, sizeof(AVCRC)*257);
+
+ if (av_crc(av_crc8005, 0, &this->frame_buffer[2], this->frame_length - 2) != 0) { /* CRC16 failed */
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "liba52:a52 frame failed crc16 checksum.\n");
current = sync_start;
this->pts = 0;
@@ -598,6 +598,7 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
this->sync_state = 0;
break;
}
+ }
#if 0
a52dec_decode_frame (this, this->pts_list[0], buf->decoder_flags & BUF_FLAG_PREVIEW);
#else