[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xine-devel
Subject:    [xine-devel] [PATCH] demux_ts: PAT/PMT CRCs calculated by av_crc()
From:       Reinhard Nissl <rnissl () gmx ! de>
Date:       2008-12-26 16:55:51
Message-ID: 1ed1c36f0db774c3cb60.1230310551 () video ! home ! test
[Download RAW message or body]

1 file changed, 5 insertions(+), 4 deletions(-)
src/demuxers/demux_ts.c |    9 +++++----



[Attachment #3 (text/x-patch)]

# HG changeset patch
# User Reinhard Nißl <rnissl@gmx.de>
# Date 1230310526 -3600
# Node ID 1ed1c36f0db774c3cb609d06de26806e79760aa1
# Parent  4ae9d1858f1e8f247031b331a132c0eec6ea995d
demux_ts: PAT/PMT CRCs calculated by av_crc() need to be converted to network byte \
order to match packet CRC

diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -140,6 +140,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
+#include <arpa/inet.h>
 
 #ifdef HAVE_FFMPEG_AVUTIL_H
 #  include <crc.h>
@@ -582,7 +583,7 @@ static void demux_ts_parse_pat (demux_ts
   }
 
   /* Check CRC. */
-  calc_crc32 = av_crc(this->class->av_crc, 0xffffffff, pkt+5, section_length+3-4);
+  calc_crc32 = htonl(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", @@ -941,7 +942,7 @@ static void demux_ts_buffer_pes(demux_ts
       m->buf->content = m->buf->mem;
       m->buf->size = m->buffered_bytes;
       m->buf->type = m->type;
-      m->buf->pts = m->pts;
+      m->buf->pts = 0;//m->pts;
       m->buf->decoder_info[0] = 1;
       if( this->input->get_length (this->input) )
         m->buf->extra_info->input_normpos = (int)( (double) \
this->input->get_current_pos (this->input) *  @@ -1201,8 +1202,8 @@ printf("Program \
Number is %i, looking fo  crc32 |= (uint32_t) \
this->pmt[program_count][section_length+3-1] ;  
   /* Check CRC. */
-  calc_crc32 = av_crc(this->class->av_crc, 0xffffffff,
-		      this->pmt[program_count], section_length+3-4);
+  calc_crc32 = htonl(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, 



------------------------------------------------------------------------------


_______________________________________________
xine-devel mailing list
xine-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic