[mythtv] transform.c (was: DVB subtitles and TS->PES decoder)

Marcus Metzler mocm at mocm.de
Fri Nov 26 20:34:32 UTC 2004

>>>>> "Juha" == Juha Kuikka <juha.kuikka at gmail.com> writes:

    Juha> On Fri, 26 Nov 2004 14:04:55 -0500, Taylor Jacob
    Juha> <rtjacob at earthlink.net> wrote:
    >> >I mean you could drop transport.c right now, most of the code
    >> in there >is not needed (only about 3-4 routines). Except for
    >> section handling,

    Juha> Yes, and I could drop the rest as I just wrote a TS->PES
    Juha> parser. :)

Well that is the TS to PES part. It takes care of the PES lengths for
video PES and of the headers for AC3 PES payload which are missing in
the TS PES because they are not needed. And of course it does some
remuxing since the PES packets are larger than the TS packets, but you
don't need that if you can handle the video and audio streams
separately. In that case you can just demux the TS and get the payload
from the TS packets ( you may also need to check the adaptation fields
for the PCRs). Only for video and AC3 you need to adapt the PES if
your player doesn't understand the exceptions for TS.

    >> I had talked to daniel about the merging of the recorder code,
    >> and I had determined that Daniel could focus on the stripped
    >> TS, and I would eventually

    Juha> Implementing this on dvbrecorder would only require
    Juha> commenting out few lines and modifying one. One question I
    Juha> do not know the answer to is "Can the player code handle TS
    Juha> stream?" and apparently if HDTV code already does it like
    Juha> this player can handle it.

    >> (maybe someone else can clean it up) but work on some other
    >> format for saving the MPEG-TS into PES or PS, which i am not
    >> sure which is the better to use.. So

    Juha> Well, I have a working, quite clean implementatio of TS->PES
    Juha> parser.  If that is the way to go. TS -> PES conversion has
    Juha> to be done at some point, question is whether it should be
    Juha> done in recorder of player. I do not know the pros and cons
    Juha> or either.

Actually, you don't need a TS to PES conversion. You need to get the
elementary stream from the TS or PS and get the timestamps from the
PES headers contained in the PS and the PCR or SCR from the TS and PS
for synching your system clock. The way this has to be done depends
on the MPEG decoder. You will have to know how to feed its elementary
stream buffer and how it keeps the time stamps.
The TS to PES (PS) routines in transform.c originated from the problem
that the FF DVB-S card needed PES of a certain size to be fed over the
DEBI port (the PS part was just to make it work with some software
players that needed SCRs).

More information about the mythtv-dev mailing list