[FFmpeg-devel] [PATCH v3 2/3] avformat/mpegts: keep track of AVProgram.pmt_version and set AV_PROGRAM_CHANGED on version updates

wm4 nfxjfg at googlemail.com
Fri May 18 12:48:31 EEST 2018

On Thu, 17 May 2018 18:13:34 -0700
Aman Gupta <aman at tmm1.net> wrote:

> On Thu, May 17, 2018 at 3:49 PM, Aman Gupta <ffmpeg at tmm1.net> wrote:
> > From: Aman Gupta <aman at tmm1.net>
> >
> > This can be used to detect changes to the streams in an AVProgram
> >  
> Forgot to add: I have seen two related patches in the wild that attempt to
> solve this same problem in different ways.
> The first is in MythTV's ffmpeg fork, where they added a void
> (*streams_changed)(void*); to AVFormatContext and call it from their mpegts
> demuxer when the PMT changes.
> The second was proposed by XBMC in
> https://ffmpeg.org/pipermail/ffmpeg-devel/2012-December/135036.html, where
> they created a new AVMEDIA_TYPE_DATA stream with id=0 and attempted to send
> packets to it whenever the PMT changed.
> The approach in this patch is similar to what's used by
> AVFormatContext.event_flags and AVFMT_EVENT_FLAG_METADATA_UPDATED.
> I re-used AVProgram.flags for this purpose (which appears not to be used
> for anything else). To be more explicit, it might be better to add
> AVProgram.event_flags. Note that either way, the user would need to clear
> AV_PROGRAM_CHANGED after detecting it (which should be documented).
> Another possibility would be to remove AV_PROGRAM_CHANGED altogether, which
> means the user would need to keep a copy of program->version and compare it
> to detect changes.

Probably needs new doxygen that says that the API user can clear that
change flag when convenient.

More information about the ffmpeg-devel mailing list