[FFmpeg-devel] [RFC] allow mpegts demuxer to reload streamsifservice disappears

Daniel Kristjansson kristja
Sat Jul 21 20:04:15 CEST 2007

On Tue, 2007-07-17 at 00:05 +0100, M?ns Rullg?rd wrote:
> "elupus" <elupus at ecce.se> writes:
> > "M?ns Rullg?rd" <mans at mansr.com> wrote in message 
> > news:yw1x4pk46lqh.fsf at thrashbarg.mansr.com...
> > "elupus" <elupus at ecce.se> writes:
> >
> > <snip>
> >
> >> Can you capture a stream where this change is needed?  I'd like to
> >> have a look.
> >>
> > so if on a channel change, the order things show up differs. ie it finds the 
> > ac3 stream first, instead of mp2 the pid's may swap. it correctly generates 
> > a new pat/pmt with a new version number on this change. so i don't think 
> > it's doing anything wrong.
> >
> > will let you know if I manage to capture such a stream again. might be easy 
> > to generate one by just concating two ts streams togheter which happen to 
> > use same pid for two different things.
> In cases like you're talking about the program id would change, and
> the correct thing to do would be to report end of stream for all
> streams in the old program, and report the appearance of a new program
> with a new set of streams.
> Unfortunately we have no means of doing this in lavf currently.

Yep, this is why we've never submitted MythTV's way of dealing with
PAT's and PMT's changing. We just use a callback to tell the application
that the streams will be changing. We do properly remove the old streams
and add new ones without breaking the streams that aren't changing (i.e.
when an audio stream comes and goes during a programme.) But what is
really needed is an ancillary data stream that tells the application
that the streams will be changing. I've always meant to rewrite this
cleanly, but haven't found the time in the two+ years we've had our
hack in place.

BTW We use ATSC tuning for ATSC channels so the program number and
PMT pid can both change for an in progress recording. We rewrite the
program number in our recorder to avoid problems with the program
number changing, and monitor the PAT for PMT pid changes. But more
importantly this allows us to keep the same decoder instance across
channel changes, which is very convenient.

-- Daniel

More information about the ffmpeg-devel mailing list