[mythtv-commits] [MythTV/mythtv] 4c4929: Scan streams again after PMT change

kmdewaal noreply at github.com
Sun Aug 13 12:53:13 UTC 2023

  Branch: refs/heads/master
  Home:   https://github.com/MythTV/mythtv
  Commit: 4c49293a5b8a531603a348fccbf90816c9d939cb
  Author: Klaas de Waal <klaas at kldo.nl>
  Date:   2023-08-13 (Sun, 13 Aug 2023)

  Changed paths:
    M mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c

  Log Message:
  Scan streams again after PMT change

When there is a change detected in the number of streams or in the type of streams after a new
PMT has been received then scan the streams again.
It is possible that the streams change during a recording. For instance, a commercial can have one
audio stream and then in the following program there can be an audio stream added.
This is what the Finnish broadcaster YLE is doing. It is completely standards-conforming but
it is as far as I am aware the only broadcaster that does this.
The original FFmpeg demuxer looks only at the streams as present in the beginning of the recording
and therefore it does not detect changes later in the recording.
Detecting stream changes while a recording is playing is a MythTV extension and it requires changes
to FFmpeg. This is one reason why there is a copy of FFmpeg included as part of MythTV, instead of
using the standard FFmpeg libraries that are part of the Linux system.
Initially the streams_changed callback was needed for correct video playback of YLE streams; see
commit ebeea33 from 2021. This did fix the problem of the screen sometimes showing only a 640x480 part
of the 1920x1080 area.
There has been a significant rewrite of the MythTV changes in file mpegts-mythtv.c in 2022 and one
result is that the video playback of YLE streams is now correct without rescanning the streams.
However, there is still the problem of audio stream changes not being picked up.
In commit ad9fb22 from 2022 it is mentioned that:
"The streams_changed callback has been disabled as it is now unnecessary
in my samples from the Finnish YLE that used to trigger it.  It could
be re-enabled if necessary."
As it appears to be still necessary this commit does exactly that.
Note that when the streams_changed callback is called there is a pause of about one second,
caused by the SeekReset that is done before the ScanStreams. It is possible that the SeekReset
can be omitted.

More information about the mythtv-commits mailing list