diff options
Diffstat (limited to 'src/demuxers/demux_ts.c')
-rw-r--r-- | src/demuxers/demux_ts.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 2f88c8963..5d85a5597 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -141,6 +141,9 @@ #include <unistd.h> #include <string.h> +/* libavutil from FFmpeg */ +#include <crc.h> + #define LOG_MODULE "demux_ts" #define LOG_VERBOSE /* @@ -272,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! */ @@ -286,6 +301,8 @@ typedef struct { input_plugin_t *input; + demux_ts_class_t *class; + int status; int blockSize; @@ -344,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) ) @@ -573,7 +579,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, } /* Check CRC. */ - calc_crc32 = _x_compute_crc32 (pkt+5, section_length+3-4, 0xffffffff); + 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", @@ -1188,8 +1194,9 @@ 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. */ - calc_crc32 = _x_compute_crc32 (this->pmt[program_count], - section_length+3-4, 0xffffffff); + calc_crc32 = av_crc(this->class->av_crc, 0xffffffff, + this->pmt[program_count], section_length+3-4); + if (crc32 != calc_crc32) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! PMT with invalid CRC32: packet_crc32: %#.8x calc_crc32: %#.8x\n", @@ -2186,6 +2193,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; @@ -2264,6 +2272,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; } |