[mythtv] [Experimental Patch] HDTV Recorder patch updated

John Patrick Poet john at BlueSkyTours.com
Fri Sep 24 20:56:32 EDT 2004


Daniel Thor Kristjansson wrote:

>The patch is available at
>  http://www.mrl.nyu.edu/~danielk/mythtv/
>
>I spent some time on the HDTV Recorder patch. I renamed most of the
>method names to begin with a capital letter to match the MythTV style.
>I'm still using C++ style casts, and K&R bracketing in many places, so
>it's not quite MythTV style compliant yet.
>
>Functionally, I've eliminated the TSPacketProcessor class and moved it's
>methods to the [ATSC,MPEG]StreamData and HDTVRecorder classes as
>appropriate. This should make DVB integration a little easier. I've also
>rewritten TSPacket to be castable from the Transport Stream buffer, and
>I've rejigged the PESPacket and PSIPTable classes so that memory
>allocation is simpler to track. This made it possible for me to
>use Valgrind to eliminate memory leaks that some earlier versions of my
>PSIP parser suffered from.
>
>By default the base_pid rewriting is disabled, which means this will
>patch breaks "Live TV". You can re-enable the hack via a define in
>"tspacket.h". But I'd like to fix the bug in ffmpeg that forces us to
>use this hack. Both because it's ugly and because it makes it impossible
>to use ATSC tables without additional hacks.
>
>I've included a copy of my settings.pro for this patch, the only thing
>you need is the "DEFINES += L2_CACHE_SIZE_KB=512" line, which is used to
>set the buffer size in HDTVRecorder. The buffer is set to half the cache
>size, minus a little. The idea is to keep as much of our stream data in
>the cache while not tossing the rest of our working set out of the cache.
>So if you have a 256kb cache or a 1024kb or 2048kb cache, set this to
>that value. For me this keeps recorder CPU below 1% while not destroying
>the performance of mythfrontend.
>
>  
>

The line in your settings.pro actually says:

DEFINES += L2_CACHE_SIZE_KB=512*4

I assume that this is correct for a 512Kbyte L2 cache.

I had to move

inline void HandleAdaptationFieldControl(const TSPacket* tspacket)

from mpegstreamdata.h to mpegstreamdata.cpp to keep it from getting 
optimized away.

Some basic output from my PBS station:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2004-09-24 18:21:07 StartRecording
createPAT()
Program Association Table
 0x0 0x0 0xb0 0x11 0x7 0xef 0xc5 0x0 0x0
    code prefix: 0x0
       table ID: 0x0
         length: 17
   table ID Ext: 0x7ef
        version: 17
        current: 1
 section number: 0
  last sec. num: 0
         tsid: 2031
 programCount: 2
  program number  has PID 0x 3e8   data  0x0 0x1 0x227 0x232
  program number  has PID 0x 3ed   data  0x0 0x2 0x227 0x237


createPMT()
           Unknown Descriptor (0x6) length(1) 0x2
old pmtProgram Map Table
    pmt version: 16
   tspacket pid: 0x3e8
 program number: 1
 section length: 29

  Stream #0
   pid: 0x31
  type: video  0x2
  info length: 3
  Stream #1
   pid: 0x34
  type: audio-ac3  0x129


pmt_pid(1000) video_pid(49) audio_pid(52)
new pmt
Program Map Table
    pmt version: 16
   tspacket pid: 0x3e8
 program number: 1
 section length: 26

  Stream #0
   pid: 0x31
  type: video  0x2
  Stream #1
   pid: 0x34
  type: audio-ac3  0x129


2004-09-24 18:21:19 PSIP packet failed CRC check
2004-09-24 18:21:24 PSIP packet failed CRC check
2004-09-24 18:21:28 PSIP packet failed CRC check
<snip>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And from my CBS station:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2004-09-24 18:32:03 StartRecording
createPAT()
Program Association Table
 0x0 0x0 0xb0 0xd 0x7 0xf3 0xc3 0x0 0x0
    c2004-09-24 18:32:04 Found changes in the todo list.
ode prefix: 0x0
       table ID: 0x0
         length: 13
   table ID Ext: 0x7f3
        version: 16
        current: 1
 section number: 0
  l2004-09-24 18:32:06 Scheduled 68 items in 1.25972 seconds.
ast sec. num: 0
         tsid: 2035
 programCount: 1
  program number  has PID 0x  20   data  0x0 0x2 0x224 0x32


createPMT()
           Unknown Descriptor (0xb) length(2) 0x42 0x3f
           Registration Descriptor   not OK
 format Identifier is 0x47413934 but should be 0x41432d33
           Unknown Descriptor (0xe) length(3) 0xc0 0xbd 0x5c
           Caption Service Descriptor
 descriptor length: 7 services count: 1

           Unknown Descriptor (0x10) length(6) 0xc0 0x2 0x71 0xc0 0x4 0x0
           Unknown Descriptor (0x6) length(1) 0x2
           Registration Descriptor   OK
           Unknown Descriptor (0xa) length(4) 0x65 0x6e 0x67 0x0
           Audio Stream Descriptor
    sample rate code: 48kbps
                bsid: 8
       bit rate code: =256kbps (12)
 Dolby surround mode: Not indicated
               bsmod: 0
      audio channels: 2/0
        full service: 1
            main ID: 6
    is text Latin-1: false
        text length: 77
               text: ""

old pmtProgram Map Table
    pmt version: 16
   tspacket pid: 0x20
 program number: 2
 section length: 78
program info length: 32

  Stream #0
   pid: 0x21
  type: video  0x2
  info length: 3
  Stream #1
   pid: 0x24
  type: audio-ac3  0x129
  info length: 17


pmt_pid(32) video_pid(33) audio_pid(36)
new pmt
Program Map Table
    pmt version: 16
   tspacket pid: 0x20
 program number: 1
 section length: 26

  Stream #0
   pid: 0x21
  type: video  0x2
  Stream #1
   pid: 0x24
  type: audio-ac3  0x129
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The CBS station was just showing some upconverted material at the time.

I am able to playback shows recorded with this patch just fine.  
Anything special you want me to test?

John





More information about the mythtv-dev mailing list