summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/audio_dec/xine_a52_decoder.c24
-rw-r--r--src/demuxers/demux_ts.c38
-rw-r--r--src/input/input_dvb.c9
3 files changed, 36 insertions, 35 deletions
diff --git a/src/audio_dec/xine_a52_decoder.c b/src/audio_dec/xine_a52_decoder.c
index 1a68af202..71adf176a 100644
--- a/src/audio_dec/xine_a52_decoder.c
+++ b/src/audio_dec/xine_a52_decoder.c
@@ -78,6 +78,7 @@ typedef struct {
int disable_dynrng_compress;
int enable_surround_downmix;
+ const AVCRC *av_crc;
} a52dec_class_t;
typedef struct a52dec_decoder_s {
@@ -586,18 +587,15 @@ 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 */
- 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;
- this->syncword = 0;
- this->sync_state = 0;
- break;
- }
+ case 3: { /* Ready for decode */
+ if (av_crc(this->class->av_crc, 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;
+ this->syncword = 0;
+ this->sync_state = 0;
+ break;
+ }
}
#if 0
a52dec_decode_frame (this, this->pts_list[0], buf->decoder_flags & BUF_FLAG_PREVIEW);
@@ -799,6 +797,8 @@ static void *init_plugin (xine_t *xine, void *data) {
this->decoder_class.description = N_("liba52 based a52 audio decoder plugin");
this->decoder_class.dispose = default_audio_decoder_class_dispose;
+ this->av_crc = av_crc_get_table(AV_CRC_16_ANSI);
+
cfg = this->config = xine->config;
this->a52_level = (float) cfg->register_range (cfg, "audio.a52.level", 100,
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index 1bab0abd5..9de28aacc 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -275,6 +275,18 @@ typedef struct {
} demux_ts_audio_track;
typedef struct {
+
+ demux_class_t demux_class;
+
+ /* class-wide, global variables here */
+
+ xine_t *xine;
+ config_values_t *config;
+
+ const AVCRC *av_crc;
+} demux_ts_class_t;
+
+typedef struct {
/*
* The first field must be the "base class" for the plugin!
*/
@@ -289,6 +301,8 @@ typedef struct {
input_plugin_t *input;
+ demux_ts_class_t *class;
+
int status;
int blockSize;
@@ -347,17 +361,6 @@ typedef struct {
} demux_ts_t;
-typedef struct {
-
- demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
-} demux_ts_class_t;
-
-
/* redefine abs as macro to handle 64-bit diffs.
i guess llabs may not be available everywhere */
#define abs(x) ( ((x)<0) ? -(x) : (x) )
@@ -576,10 +579,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
}
/* Check CRC. */
- if ( ! *av_crc04C11DB7 )
- av_crc_init(av_crc04C11DB7, 0, 32, AV_CRC_32_IEEE, sizeof(AVCRC)*257);
-
- calc_crc32 = av_crc(av_crc04C11DB7, 0xffffffff, pkt+5, section_length+3-4);
+ calc_crc32 = av_crc(this->class->av_crc, 0xffffffff, pkt+5, section_length+3-4);
if (crc32 != calc_crc32) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
"demux_ts: demux error! PAT with invalid CRC32: packet_crc32: %.8x calc_crc32: %.8x\n",
@@ -1185,10 +1185,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
crc32 |= (uint32_t) this->pmt[program_count][section_length+3-1] ;
/* Check CRC. */
- if ( ! *av_crc04C11DB7 )
- av_crc_init(av_crc04C11DB7, 0, 32, AV_CRC_32_IEEE, sizeof(AVCRC)*257);
-
- calc_crc32 = av_crc(av_crc04C11DB7, 0xffffffff,
+ calc_crc32 = av_crc(this->class->av_crc, 0xffffffff,
this->pmt[program_count], section_length+3-4);
if (crc32 != calc_crc32) {
@@ -2187,6 +2184,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
this = xine_xmalloc(sizeof(*this));
this->stream = stream;
this->input = input;
+ this->class = class_gen;
this->blockSize = PKT_SIZE;
this->demux_plugin.send_headers = demux_ts_send_headers;
@@ -2265,6 +2263,8 @@ static void *init_class (xine_t *xine, void *data) {
this->demux_class.extensions = "ts m2t trp dvb:// dvbs:// dvbc:// dvbt://";
this->demux_class.dispose = default_demux_class_dispose;
+ this->av_crc = av_crc_get_table(AV_CRC_32_IEEE);
+
return this;
}
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index 9f53d6b90..51e4d47aa 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -298,6 +298,8 @@ typedef struct {
int numchannels;
char *autoplaylist[MAX_AUTOCHANNELS];
+
+ const AVCRC *av_crc;
} dvb_input_class_t;
typedef struct {
@@ -2453,9 +2455,6 @@ static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * origin
originalPkt+=data_offset;
if (pid == 0 && sync_byte==0x47) {
- if ( ! *av_crc04C11DB7 )
- av_crc_init(av_crc04C11DB7, 0, 32, AV_CRC_32_IEEE, sizeof(AVCRC)*257);
-
unsigned long crc;
originalPkt[3]=13; /* section length including CRC - first 3 bytes */
@@ -2467,7 +2466,7 @@ static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * origin
originalPkt[11]=(this->channels[this->channel].pmtpid >> 8) & 0xff;
originalPkt[12]=this->channels[this->channel].pmtpid & 0xff;
- crc = av_crc(av_crc04C11DB7, 0xffffffff, originalPkt+1, 12);
+ crc = av_crc(this->class->av_crc, 0xffffffff, originalPkt+1, 12);
originalPkt[13]=(crc>>24) & 0xff;
originalPkt[14]=(crc>>16) & 0xff;
@@ -3268,6 +3267,8 @@ static void *init_class (xine_t *xine, void *data) {
this->mrls[4] = "dvba://";
this->mrls[5] = 0;
+ this->av_crc = av_crc_get_table(AV_CRC_32_IEEE);
+
xprintf(this->xine,XINE_VERBOSITY_DEBUG,"init class succeeded\n");
/* Enable remembering of last watched channel */