summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_ts.c
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-11-14 21:55:11 +0100
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-11-14 21:55:11 +0100
commit9aab0fa061a6c0ce3f83c28732a37fce7c6cb289 (patch)
treed60295ef743a05e3239d802004a30469b8ce2deb /src/demuxers/demux_ts.c
parentc813dd036abc7286138f62dc04dc9098c10ceede (diff)
parent0ae296e7cb050cbc42f78feaccf3050e068cb152 (diff)
downloadxine-lib-9aab0fa061a6c0ce3f83c28732a37fce7c6cb289.tar.gz
xine-lib-9aab0fa061a6c0ce3f83c28732a37fce7c6cb289.tar.bz2
Merge changes.
Diffstat (limited to 'src/demuxers/demux_ts.c')
-rw-r--r--src/demuxers/demux_ts.c37
1 files changed, 4 insertions, 33 deletions
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index d7fd24773..19826bf71 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -17,8 +17,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
- * $Id: demux_ts.c,v 1.129 2007/04/02 10:46:08 dgp85 Exp $
- *
* Demultiplexer for MPEG2 Transport Streams.
*
* For the purposes of playing video, we make some assumptions about the
@@ -298,7 +296,6 @@ typedef struct {
uint32_t pmt_pid[MAX_PMTS];
uint8_t *pmt[MAX_PMTS];
uint8_t *pmt_write_ptr[MAX_PMTS];
- uint32_t crc32_table[256];
uint32_t last_pmt_crc;
/*
* Stuff to do with the transport header. As well as the video
@@ -358,28 +355,6 @@ typedef struct {
} demux_ts_class_t;
-static void demux_ts_build_crc32_table(demux_ts_t*this) {
- uint32_t i, j, k;
-
- for( i = 0 ; i < 256 ; i++ ) {
- k = 0;
- for (j = (i << 24) | 0x800000 ; j != 0x80000000 ; j <<= 1) {
- k = (k << 1) ^ (((k ^ j) & 0x80000000) ? 0x04c11db7 : 0);
- }
- this->crc32_table[i] = k;
- }
-}
-
-static uint32_t demux_ts_compute_crc32(demux_ts_t*this, uint8_t *data,
- uint32_t length, uint32_t crc32) {
- uint32_t i;
-
- for(i = 0; i < length; i++) {
- crc32 = (crc32 << 8) ^ this->crc32_table[(crc32 >> 24) ^ data[i]];
- }
- return crc32;
-}
-
/* redefine abs as macro to handle 64-bit diffs.
i guess llabs may not be available everywhere */
#define abs(x) ( ((x)<0) ? -(x) : (x) )
@@ -523,7 +498,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
unsigned char *pkt, unsigned int pusi) {
uint32_t table_id;
uint32_t section_syntax_indicator;
- uint32_t section_length;
+ int32_t section_length;
uint32_t transport_stream_id;
uint32_t version_number;
uint32_t current_next_indicator;
@@ -598,8 +573,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
}
/* Check CRC. */
- calc_crc32 = demux_ts_compute_crc32 (this, pkt+5, section_length+3-4,
- 0xffffffff);
+ calc_crc32 = _x_compute_crc32 (pkt+5, section_length+3-4, 0xffffffff);
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",
@@ -1205,9 +1179,8 @@ 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 = demux_ts_compute_crc32 (this,
- this->pmt[program_count],
- section_length+3-4, 0xffffffff);
+ calc_crc32 = _x_compute_crc32 (this->pmt[program_count],
+ section_length+3-4, 0xffffffff);
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",
@@ -2028,8 +2001,6 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) {
this->send_newpts = 1;
- demux_ts_build_crc32_table (this);
-
this->status = DEMUX_OK ;
this->send_end_buffers = 1;