summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2018-05-17 15:30:21 -0700
committerAman Gupta <aman@tmm1.net>2018-05-18 19:00:29 -0700
commit2b2f2f65f38cdd64fe126079f84872c0b06c6afc (patch)
treeb3356e212f2d547ca246d6724ddcfc3cac44c0dc /libavformat/utils.c
parent79126ce80e21f2bc986fef7b8f0d6335136538da (diff)
avformat: add fields to AVProgram/AVStream for PMT change tracking
These fields will allow the mpegts demuxer to expose details about the PMT/program which created the AVProgram and its AVStreams. In mpegts, a PMT which advertises streams has a version number which can be incremented at any time. When the version changes, the pids which correspond to each of it's streams can also change. Since ffmpeg creates a new AVStream per pid by default, an API user needs the ability to (a) detect when the PMT changed, and (b) tell which AVStream were added to replace earlier streams. This has been a long-standing issue with ffmpeg's handling of mpegts streams with PMT changes, and I found two related patches in the wild that attempt to solve the same problem: The first is in MythTV's ffmpeg fork, where they added a void (*streams_changed)(void*); to AVFormatContext and call it from their fork of the mpegts demuxer whenever 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. Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 636fae3779..a4aa4e10b1 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4569,6 +4569,7 @@ AVProgram *av_new_program(AVFormatContext *ac, int id)
return NULL;
dynarray_add(&ac->programs, &ac->nb_programs, program);
program->discard = AVDISCARD_NONE;
+ program->pmt_version = -1;
}
program->id = id;
program->pts_wrap_reference = AV_NOPTS_VALUE;