[mythtv] AC3 + bigdvb3.5 + australia + transport.c

Marcus Metzler mocm at mocm.de
Wed Jan 12 08:46:25 EST 2005


>>>>> "Mark" == Mark Anderson <markjanderson at mail.com> writes:

    Mark> Folks, After a number of hours starting at hex dumps and
    Mark> trying to learn a bit about mpeg/dvb protocols I have
    Mark> finally found the problem with transport.c, unfortunately I
    Mark> haven't been able to craft some code that actually fixes it.

    Mark> The problem: The 9th byte of the mpeg2 data is the header
    Mark> length, in australia for AC3 payload this is always set to 7
    Mark> bytes. The code in transport.c only ever puts 4 of the 7
    Mark> bytes into the transformed stream. mpeg.c looks at the
    Mark> header length and makes sure it pulls out that many bytes:

    Mark> The code in mpegps_read_pes_header is:

    Mark>     len -= header_len; while (header_len > 0) {
    Mark> get_byte(&s->pb); header_len--; }


    Mark> Because transform has not put the last three bytes of the
    Mark> header in, mpeg.c pulls out the wrong bytes and everything
    Mark> goes downhill from there. I have confirmed that if transport
    Mark> puts the full 7 bytes in the it all works fine.

    Mark> I added the following code to write_ipack in transport.c to
    Mark> try to fix this:

    Mark>  /*write in the rest of the header as specified by
    Mark> p->hlength*/ if ((p->cid == PRIVATE_STREAM1) && (p->count ==
    Mark> 13)) { while (p->count < (p->hlength + 9)) {
    p-> buf[p->count++] = data[p->count - 13];
    Mark>                 } }

    Mark> This almost does it except there are 3 additonal bytes after
    Mark> the four byte streamid/ac3_off header. If I hack mpeg.c to
    Mark> pull the extras out it produces perfect audio. The reason
    Mark> the extra three bytes are added due to the above code is
    Mark> that it adds the reast of the header, but since write_ipack
    Mark> has no way of telling the caller that it has used up some
    Mark> bytes out of its source buffer, the bytes are re-added in
    Mark> the next call to write_ipack.

    Mark> Marcus, since you are much more familiar with this code,
    Mark> maybe you could work out how to get the proper header bytes
    Mark> added?

It`s all my fault. I did not copy the entire header of the PES, that`s
probably because the original purpose of the program was to cut down
the PES so that the DVB driver for the full featured cards could send
them via the DEBI port. Anyway, I think I fixed it now and also
removed some more unneeded parts of transform.c.

Here is the diff:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: trans.diff
Type: application/octet-stream
Size: 2256 bytes
Desc: trans.diff
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20050112/d495a1de/trans.obj
-------------- next part --------------

Marcus

-- 
/--------------------------------------------------------------------\
| Dr. Marcus O.C. Metzler        |                                   |
| mocm at metzlerbros.de            | http://www.metzlerbros.de/        |
\--------------------------------------------------------------------/
 |>>>             Quis custodiet ipsos custodies                 <<<|


More information about the mythtv-dev mailing list