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

Mark Anderson markjanderson at mail.com
Thu Jan 13 06:15:43 EST 2005


Folks, 

Attahced is a new version of the AC3 bigdvb patch. 

1. It contains a fully functioning transport.c that requires no mpeg.c hack, 
finally! It is a combintation of Marcus' changes and mine.

2. I have also started implementing/fixing audio track selection through the 
+/- keys. I think it might actually work for TS recording, but haven't tested 
it. This should also allow toggling of languages where avialable, however I 
have no streams to test it against here in oz. 

3. Included is an attempt to fix the audio change problems in the TS recoding, 
again it is not tested but has a good chance of working. Tim can you test it?

4. There is still some code in transport.c that I have ifdef'd out. Everything 
I have tested works without it and if it is left in then there is audio 
stuttering.

Cheers,
Mark Anderson

On Thu, 13 Jan 2005 09:17 am, Mark Anderson wrote:
> On Wed, 12 Jan 2005 09:15 am, Mark Anderson wrote:
>
> I fixed the audio in trandsport.c, unfortunatley I screwed up the video.
> Attached is the diff as it stands, anyone see anything obvious causing the
> video screw up?
>
> The diff is applied againts the original transport.c and no mpeg.c hack is
> needed.
>
> Cheers,
> Mark.
>
> > Folks,
> >
> > After a number of hours starting at hex dumps and trying. to learn a bit
> > about mpeg/dvb protocols I have finally found the problem with
> > transport.c, unfortunately I haven't been able to craft some code that
> > actually fixes it.
> >
> > The problem: The 9th byte of the mpeg2 data is the header length, in
> > australia for AC3 payload this is always set to 7 bytes. The code in
> > transport.c only ever puts 4 of the 7 bytes into the transformed stream.
> > mpeg.c looks at the header length and makes sure it pulls out that many
> > bytes:
> >
> > The code in mpegps_read_pes_header is:
> >
> >     len -= header_len;
> >         while (header_len > 0) {
> >             get_byte(&s->pb);
> >             header_len--;
> >         }
> >
> >
> > Because transform has not put the last three bytes of the header in,
> > mpeg.c pulls out the wrong bytes and everything goes downhill from there.
> > I have confirmed that if transport puts the full 7 bytes in the it all
> > works fine.
> >
> > I added the following code to write_ipack in transport.c to try to fix
> > this:
> >
> >  /*write in the rest of the header as specified by p->hlength*/
> >         if ((p->cid == PRIVATE_STREAM1) && (p->count == 13))
> >         {
> >                 while (p->count < (p->hlength + 9))
> >                 {
> >                         p->buf[p->count++] = data[p->count - 13];
> >                 }
> >         }
> >
> > This almost does it except there are 3 additonal bytes after the four
> > byte streamid/ac3_off header. If I hack mpeg.c to pull the extras out it
> > produces perfect audio. The reason the extra three bytes are added due to
> > the above code is that it adds the reast of the header, but since
> > write_ipack has no way of telling the caller that it has used up some
> > bytes out of its source buffer, the bytes are re-added in the next call
> > to write_ipack.
> >
> > Marcus, since you are much more familiar with this code, maybe you could
> > work out how to get the proper header bytes added?
> >
> > Cheers,
> > Mark Anderson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oz-ac3-bigdvb3.5v3.diff
Type: text/x-diff
Size: 32097 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20050113/16ac83a3/oz-ac3-bigdvb3.5v3.bin


More information about the mythtv-dev mailing list