[FFmpeg-devel,3/3] avformat: don't "merge" side data into packet data by default

Submitted by wm4 on March 8, 2017, 12:40 p.m.

Details

Message ID 20170308124012.27793-3-nfxjfg@googlemail.com
State New
Headers show

Commit Message

wm4 March 8, 2017, 12:40 p.m.
Side data are separate AVPacket fields for a reason. Merging side data
requires reallocating all packets, is complex, potentially clashes with
"actual" packet data (you could probably come up with PCM data that
looks like merged side data, or such), and could for example cause
trouble to people trying to feed packets with merged side data to
non-libavcodec decoders.

Disable it by default.

I do not consider this a real API change, because the AVPacket side data
fields have been part of the API for at least a decade.

The changed tests either reflect added packet side data, or the changed
packet size due to merged side data removal reducing the packet size.

---
Missing: minor libavformat API bump, maybe a warning in APIchanges
---
 libavformat/options_table.h                   |   2 +-
 libavformat/utils.c                           |   3 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 192 +++++++++++++++++---------
 tests/ref/fate/gaplessenc-itunes-to-ipod-aac  |   4 +-
 tests/ref/fate/gaplessenc-pcm-to-mov-aac      |   4 +-
 tests/ref/fate/gaplessinfo-itunes1            |   4 +-
 tests/ref/fate/gaplessinfo-itunes2            |   4 +-
 tests/ref/fate/mov-aac-2048-priming           |   3 +-
 tests/ref/seek/cache-pipe                     |  10 +-
 tests/ref/seek/extra-mp3                      |  18 +--
 tests/ref/seek/lavf-ts                        |  54 ++++----
 tests/ref/seek/mkv-codec-delay                |  14 +-
 12 files changed, 188 insertions(+), 124 deletions(-)

Comments

Michael Niedermayer March 8, 2017, 2:44 p.m.
On Wed, Mar 08, 2017 at 01:40:12PM +0100, wm4 wrote:
> Side data are separate AVPacket fields for a reason. Merging side data
> requires reallocating all packets, is complex, potentially clashes with
> "actual" packet data (you could probably come up with PCM data that
> looks like merged side data, or such), and could for example cause
> trouble to people trying to feed packets with merged side data to
> non-libavcodec decoders.
> 
> Disable it by default.
> 
> I do not consider this a real API change, because the AVPacket side data
> fields have been part of the API for at least a decade.
> 
> The changed tests either reflect added packet side data, or the changed
> packet size due to merged side data removal reducing the packet size.
> 
> ---

> Missing: minor libavformat API bump, maybe a warning in APIchanges

this is a ABI change and cannot be done before the next
major version bump

Applications did not need to preserve side data between layers and
this patch would add this requirement

The change of the default could be done conditional on the major
version or related API/ABI define

[...]
wm4 March 8, 2017, 3:08 p.m.
On Wed, 8 Mar 2017 15:44:36 +0100
Michael Niedermayer <michael@niedermayer.cc> wrote:

> On Wed, Mar 08, 2017 at 01:40:12PM +0100, wm4 wrote:
> > Side data are separate AVPacket fields for a reason. Merging side data
> > requires reallocating all packets, is complex, potentially clashes with
> > "actual" packet data (you could probably come up with PCM data that
> > looks like merged side data, or such), and could for example cause
> > trouble to people trying to feed packets with merged side data to
> > non-libavcodec decoders.
> > 
> > Disable it by default.
> > 
> > I do not consider this a real API change, because the AVPacket side data
> > fields have been part of the API for at least a decade.
> > 
> > The changed tests either reflect added packet side data, or the changed
> > packet size due to merged side data removal reducing the packet size.
> > 
> > ---  
> 
> > Missing: minor libavformat API bump, maybe a warning in APIchanges  
> 
> this is a ABI change and cannot be done before the next
> major version bump

Well, when you _added_ this side data merging, which is a whole lot
worse on the scale of API breaks, you didn't even need a minor version
bump.

Why is it different now?

> Applications did not need to preserve side data between layers and
> this patch would add this requirement
> 
> The change of the default could be done conditional on the major
> version or related API/ABI define
> 
> [...]
wm4 March 9, 2017, 9:22 a.m.
On Wed, 8 Mar 2017 15:44:36 +0100
Michael Niedermayer <michael@niedermayer.cc> wrote:

> On Wed, Mar 08, 2017 at 01:40:12PM +0100, wm4 wrote:
> > Side data are separate AVPacket fields for a reason. Merging side data
> > requires reallocating all packets, is complex, potentially clashes with
> > "actual" packet data (you could probably come up with PCM data that
> > looks like merged side data, or such), and could for example cause
> > trouble to people trying to feed packets with merged side data to
> > non-libavcodec decoders.
> > 
> > Disable it by default.
> > 
> > I do not consider this a real API change, because the AVPacket side data
> > fields have been part of the API for at least a decade.
> > 
> > The changed tests either reflect added packet side data, or the changed
> > packet size due to merged side data removal reducing the packet size.
> > 
> > ---  
> 
> > Missing: minor libavformat API bump, maybe a warning in APIchanges  
> 
> this is a ABI change and cannot be done before the next
> major version bump
> 
> Applications did not need to preserve side data between layers and
> this patch would add this requirement
> 
> The change of the default could be done conditional on the major
> version or related API/ABI define

So what's the status on this? I consider it a bug fix, not an API
change.
Michael Niedermayer March 9, 2017, 11:51 a.m.
On Thu, Mar 09, 2017 at 10:22:39AM +0100, wm4 wrote:
> On Wed, 8 Mar 2017 15:44:36 +0100
> Michael Niedermayer <michael@niedermayer.cc> wrote:
> 
> > On Wed, Mar 08, 2017 at 01:40:12PM +0100, wm4 wrote:
> > > Side data are separate AVPacket fields for a reason. Merging side data
> > > requires reallocating all packets, is complex, potentially clashes with
> > > "actual" packet data (you could probably come up with PCM data that
> > > looks like merged side data, or such), and could for example cause
> > > trouble to people trying to feed packets with merged side data to
> > > non-libavcodec decoders.
> > > 
> > > Disable it by default.
> > > 
> > > I do not consider this a real API change, because the AVPacket side data
> > > fields have been part of the API for at least a decade.
> > > 
> > > The changed tests either reflect added packet side data, or the changed
> > > packet size due to merged side data removal reducing the packet size.
> > > 
> > > ---  
> > 
> > > Missing: minor libavformat API bump, maybe a warning in APIchanges  
> > 
> > this is a ABI change and cannot be done before the next
> > major version bump
> > 
> > Applications did not need to preserve side data between layers and
> > this patch would add this requirement
> > 

> > The change of the default could be done conditional on the major
> > version or related API/ABI define
> 
> So what's the status on this? I consider it a bug fix, not an API
> change.

Then we disagree here i think

[...]
wm4 March 9, 2017, 12:09 p.m.
On Thu, 9 Mar 2017 12:51:30 +0100
Michael Niedermayer <michael@niedermayer.cc> wrote:

> On Thu, Mar 09, 2017 at 10:22:39AM +0100, wm4 wrote:
> > On Wed, 8 Mar 2017 15:44:36 +0100
> > Michael Niedermayer <michael@niedermayer.cc> wrote:
> >   
> > > On Wed, Mar 08, 2017 at 01:40:12PM +0100, wm4 wrote:  
> > > > Side data are separate AVPacket fields for a reason. Merging side data
> > > > requires reallocating all packets, is complex, potentially clashes with
> > > > "actual" packet data (you could probably come up with PCM data that
> > > > looks like merged side data, or such), and could for example cause
> > > > trouble to people trying to feed packets with merged side data to
> > > > non-libavcodec decoders.
> > > > 
> > > > Disable it by default.
> > > > 
> > > > I do not consider this a real API change, because the AVPacket side data
> > > > fields have been part of the API for at least a decade.
> > > > 
> > > > The changed tests either reflect added packet side data, or the changed
> > > > packet size due to merged side data removal reducing the packet size.
> > > > 
> > > > ---    
> > >   
> > > > Missing: minor libavformat API bump, maybe a warning in APIchanges    
> > > 
> > > this is a ABI change and cannot be done before the next
> > > major version bump
> > > 
> > > Applications did not need to preserve side data between layers and
> > > this patch would add this requirement
> > >   
> 
> > > The change of the default could be done conditional on the major
> > > version or related API/ABI define  
> > 
> > So what's the status on this? I consider it a bug fix, not an API
> > change.  
> 
> Then we disagree here i think

Don't you think it's weird that AVPacket.side_data by default appears
to be unused to the API user?

Functionally, it's pretty much like a bug.

Patch hide | download patch | download mbox

diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index a537dda95e..fefa1903d0 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -39,7 +39,7 @@  static const AVOption avformat_options[] = {
 {"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT64, {.i64 = 5000000 }, 32, INT64_MAX, D},
 {"formatprobesize", "number of bytes to probe file format", OFFSET(format_probesize), AV_OPT_TYPE_INT, {.i64 = PROBE_BUF_MAX}, 0, INT_MAX-1, D},
 {"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, E},
-{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVFMT_FLAG_FLUSH_PACKETS | AVFMT_FLAG_AUTO_BSF }, INT_MIN, INT_MAX, D|E, "fflags"},
+{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVFMT_FLAG_FLUSH_PACKETS | AVFMT_FLAG_AUTO_BSF | AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D|E, "fflags"},
 {"flush_packets", "reduce the latency by flushing out packets immediately", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, E, "fflags"},
 {"ignidx", "ignore index", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_IGNIDX }, INT_MIN, INT_MAX, D, "fflags"},
 {"genpts", "generate pts", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_GENPTS }, INT_MIN, INT_MAX, D, "fflags"},
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 68f3c977d6..69fc4d7b51 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -840,8 +840,7 @@  int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
             *pkt = tmp;
         }
 
-        if (strcmp(s->iformat->name, "concat") && strcmp(s->iformat->name, "hls,applehttp")
-            && av_packet_split_side_data(pkt) == 1) {
+        if (av_packet_split_side_data(pkt) == 1) {
             av_log(s, AV_LOG_ERROR,
                    "FFmpeg-style merged side data found in raw packet. "
                    "The packet is rejected for security reasons.\n");
diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
index 4cb9f5ca7a..880f9b7e03 100644
--- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
+++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
@@ -1,12 +1,21 @@ 
-video|1|982|0.010911|-2618|-0.029089|3600|0.040000|N/A|N/A|24815|564|K_
-video|1|4582|0.050911|982|0.010911|3600|0.040000|N/A|N/A|16443|27072|__
-video|1|8182|0.090911|4582|0.050911|3600|0.040000|N/A|N/A|14522|44932|__
-video|1|11782|0.130911|8182|0.090911|3600|0.040000|N/A|N/A|12636|60536|__
-video|1|15382|0.170911|11782|0.130911|3600|0.040000|N/A|N/A|13407|74260|__
-video|1|18982|0.210911|15382|0.170911|3600|0.040000|N/A|N/A|13106|88924|__
-video|1|22582|0.250911|18982|0.210911|3600|0.040000|N/A|N/A|12769|102836|__
-video|1|26182|0.290911|22582|0.250911|3600|0.040000|N/A|N/A|12037|116748|__
-audio|0|0|0.000000|0|0.000000|2351|0.026122|N/A|N/A|222|159988|K_
+video|1|982|0.010911|-2618|-0.029089|3600|0.040000|N/A|N/A|24801|564|K_MPEGTS Stream ID|1
+
+video|1|4582|0.050911|982|0.010911|3600|0.040000|N/A|N/A|16429|27072|__MPEGTS Stream ID|1
+
+video|1|8182|0.090911|4582|0.050911|3600|0.040000|N/A|N/A|14508|44932|__MPEGTS Stream ID|1
+
+video|1|11782|0.130911|8182|0.090911|3600|0.040000|N/A|N/A|12622|60536|__MPEGTS Stream ID|1
+
+video|1|15382|0.170911|11782|0.130911|3600|0.040000|N/A|N/A|13393|74260|__MPEGTS Stream ID|1
+
+video|1|18982|0.210911|15382|0.170911|3600|0.040000|N/A|N/A|13092|88924|__MPEGTS Stream ID|1
+
+video|1|22582|0.250911|18982|0.210911|3600|0.040000|N/A|N/A|12755|102836|__MPEGTS Stream ID|1
+
+video|1|26182|0.290911|22582|0.250911|3600|0.040000|N/A|N/A|12023|116748|__MPEGTS Stream ID|1
+
+audio|0|0|0.000000|0|0.000000|2351|0.026122|N/A|N/A|208|159988|K_MPEGTS Stream ID|1
+
 audio|0|2351|0.026122|2351|0.026122|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|4702|0.052244|4702|0.052244|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|7053|0.078367|7053|0.078367|2351|0.026122|N/A|N/A|209|N/A|K_
@@ -20,17 +29,28 @@  audio|0|23510|0.261222|23510|0.261222|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|25861|0.287344|25861|0.287344|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|28212|0.313467|28212|0.313467|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|30563|0.339589|30563|0.339589|2351|0.026122|N/A|N/A|209|N/A|K_
-video|1|29782|0.330911|26182|0.290911|3600|0.040000|N/A|N/A|14112|130096|__
-video|1|33382|0.370911|29782|0.330911|3600|0.040000|N/A|N/A|13343|145324|__
-video|1|36982|0.410911|33382|0.370911|3600|0.040000|N/A|N/A|12149|162996|__
-video|1|40582|0.450911|36982|0.410911|3600|0.040000|N/A|N/A|12296|176344|__
-video|1|44182|0.490911|40582|0.450911|3600|0.040000|N/A|N/A|24800|189692|K_
-video|1|47782|0.530911|44182|0.490911|3600|0.040000|N/A|N/A|17454|216388|__
-video|1|51382|0.570911|47782|0.530911|3600|0.040000|N/A|N/A|15033|235000|__
-video|1|54982|0.610911|51382|0.570911|3600|0.040000|N/A|N/A|13463|251356|__
-video|1|58582|0.650911|54982|0.610911|3600|0.040000|N/A|N/A|12412|266020|__
-video|1|62182|0.690911|58582|0.650911|3600|0.040000|N/A|N/A|13469|279744|__
-audio|0|32915|0.365722|32915|0.365722|2351|0.026122|N/A|N/A|223|322608|K_
+video|1|29782|0.330911|26182|0.290911|3600|0.040000|N/A|N/A|14098|130096|__MPEGTS Stream ID|1
+
+video|1|33382|0.370911|29782|0.330911|3600|0.040000|N/A|N/A|13329|145324|__MPEGTS Stream ID|1
+
+video|1|36982|0.410911|33382|0.370911|3600|0.040000|N/A|N/A|12135|162996|__MPEGTS Stream ID|1
+
+video|1|40582|0.450911|36982|0.410911|3600|0.040000|N/A|N/A|12282|176344|__MPEGTS Stream ID|1
+
+video|1|44182|0.490911|40582|0.450911|3600|0.040000|N/A|N/A|24786|189692|K_MPEGTS Stream ID|1
+
+video|1|47782|0.530911|44182|0.490911|3600|0.040000|N/A|N/A|17440|216388|__MPEGTS Stream ID|1
+
+video|1|51382|0.570911|47782|0.530911|3600|0.040000|N/A|N/A|15019|235000|__MPEGTS Stream ID|1
+
+video|1|54982|0.610911|51382|0.570911|3600|0.040000|N/A|N/A|13449|251356|__MPEGTS Stream ID|1
+
+video|1|58582|0.650911|54982|0.610911|3600|0.040000|N/A|N/A|12398|266020|__MPEGTS Stream ID|1
+
+video|1|62182|0.690911|58582|0.650911|3600|0.040000|N/A|N/A|13455|279744|__MPEGTS Stream ID|1
+
+audio|0|32915|0.365722|32915|0.365722|2351|0.026122|N/A|N/A|209|322608|K_MPEGTS Stream ID|1
+
 audio|0|35266|0.391844|35266|0.391844|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|37617|0.417967|37617|0.417967|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|39968|0.444089|39968|0.444089|2351|0.026122|N/A|N/A|209|N/A|K_
@@ -44,12 +64,18 @@  audio|0|56425|0.626944|56425|0.626944|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|58776|0.653067|58776|0.653067|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|61127|0.679189|61127|0.679189|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|63478|0.705311|63478|0.705311|2351|0.026122|N/A|N/A|209|N/A|K_
-video|1|65782|0.730911|62182|0.690911|3600|0.040000|N/A|N/A|13850|294408|__
-video|1|69382|0.770911|65782|0.730911|3600|0.040000|N/A|N/A|12177|309448|__
-video|1|72982|0.810911|69382|0.770911|3600|0.040000|N/A|N/A|12706|325992|__
-video|1|76582|0.850911|72982|0.810911|3600|0.040000|N/A|N/A|10838|339528|__
-video|1|80182|0.890911|76582|0.850911|3600|0.040000|N/A|N/A|11300|351372|__
-audio|0|65829|0.731433|65829|0.731433|2351|0.026122|N/A|N/A|223|404576|K_
+video|1|65782|0.730911|62182|0.690911|3600|0.040000|N/A|N/A|13836|294408|__MPEGTS Stream ID|1
+
+video|1|69382|0.770911|65782|0.730911|3600|0.040000|N/A|N/A|12163|309448|__MPEGTS Stream ID|1
+
+video|1|72982|0.810911|69382|0.770911|3600|0.040000|N/A|N/A|12692|325992|__MPEGTS Stream ID|1
+
+video|1|76582|0.850911|72982|0.810911|3600|0.040000|N/A|N/A|10824|339528|__MPEGTS Stream ID|1
+
+video|1|80182|0.890911|76582|0.850911|3600|0.040000|N/A|N/A|11286|351372|__MPEGTS Stream ID|1
+
+audio|0|65829|0.731433|65829|0.731433|2351|0.026122|N/A|N/A|209|404576|K_MPEGTS Stream ID|1
+
 audio|0|68180|0.757556|68180|0.757556|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|70531|0.783678|70531|0.783678|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|72882|0.809800|72882|0.809800|2351|0.026122|N/A|N/A|209|N/A|K_
@@ -60,17 +86,27 @@  audio|0|82286|0.914289|82286|0.914289|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|84637|0.940411|84637|0.940411|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|86988|0.966533|86988|0.966533|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|89339|0.992656|89339|0.992656|2351|0.026122|N/A|N/A|209|N/A|K_
-video|1|83782|0.930911|80182|0.890911|3600|0.040000|N/A|N/A|12692|363592|__
+video|1|83782|0.930911|80182|0.890911|3600|0.040000|N/A|N/A|12678|363592|__MPEGTS Stream ID|1
+
 video|1|87382|0.970911|83782|0.930911|3600|0.040000|N/A|N/A|24711|377880|K_
-video|1|91964|1.021822|88364|0.981822|3600|0.040000|N/A|N/A|24815|564|K_
-video|1|95564|1.061822|91964|1.021822|3600|0.040000|N/A|N/A|16443|27072|__
-video|1|99164|1.101822|95564|1.061822|3600|0.040000|N/A|N/A|14522|44932|__
-video|1|102764|1.141822|99164|1.101822|3600|0.040000|N/A|N/A|12636|60536|__
-video|1|106364|1.181822|102764|1.141822|3600|0.040000|N/A|N/A|13407|74260|__
-video|1|109964|1.221822|106364|1.181822|3600|0.040000|N/A|N/A|13106|88924|__
-video|1|113564|1.261822|109964|1.221822|3600|0.040000|N/A|N/A|12769|102836|__
-video|1|117164|1.301822|113564|1.261822|3600|0.040000|N/A|N/A|12037|116748|__
-audio|0|90982|1.010911|90982|1.010911|2351|0.026122|N/A|N/A|222|159988|K_
+video|1|91964|1.021822|88364|0.981822|3600|0.040000|N/A|N/A|24801|564|K_MPEGTS Stream ID|1
+
+video|1|95564|1.061822|91964|1.021822|3600|0.040000|N/A|N/A|16429|27072|__MPEGTS Stream ID|1
+
+video|1|99164|1.101822|95564|1.061822|3600|0.040000|N/A|N/A|14508|44932|__MPEGTS Stream ID|1
+
+video|1|102764|1.141822|99164|1.101822|3600|0.040000|N/A|N/A|12622|60536|__MPEGTS Stream ID|1
+
+video|1|106364|1.181822|102764|1.141822|3600|0.040000|N/A|N/A|13393|74260|__MPEGTS Stream ID|1
+
+video|1|109964|1.221822|106364|1.181822|3600|0.040000|N/A|N/A|13092|88924|__MPEGTS Stream ID|1
+
+video|1|113564|1.261822|109964|1.221822|3600|0.040000|N/A|N/A|12755|102836|__MPEGTS Stream ID|1
+
+video|1|117164|1.301822|113564|1.261822|3600|0.040000|N/A|N/A|12023|116748|__MPEGTS Stream ID|1
+
+audio|0|90982|1.010911|90982|1.010911|2351|0.026122|N/A|N/A|208|159988|K_MPEGTS Stream ID|1
+
 audio|0|93333|1.037033|93333|1.037033|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|95684|1.063156|95684|1.063156|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|98035|1.089278|98035|1.089278|2351|0.026122|N/A|N/A|209|N/A|K_
@@ -84,17 +120,28 @@  audio|0|114492|1.272133|114492|1.272133|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|116843|1.298256|116843|1.298256|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|119194|1.324378|119194|1.324378|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|121545|1.350500|121545|1.350500|2351|0.026122|N/A|N/A|209|N/A|K_
-video|1|120764|1.341822|117164|1.301822|3600|0.040000|N/A|N/A|14112|130096|__
-video|1|124364|1.381822|120764|1.341822|3600|0.040000|N/A|N/A|13343|145324|__
-video|1|127964|1.421822|124364|1.381822|3600|0.040000|N/A|N/A|12149|162996|__
-video|1|131564|1.461822|127964|1.421822|3600|0.040000|N/A|N/A|12296|176344|__
-video|1|135164|1.501822|131564|1.461822|3600|0.040000|N/A|N/A|24800|189692|K_
-video|1|138764|1.541822|135164|1.501822|3600|0.040000|N/A|N/A|17454|216388|__
-video|1|142364|1.581822|138764|1.541822|3600|0.040000|N/A|N/A|15033|235000|__
-video|1|145964|1.621822|142364|1.581822|3600|0.040000|N/A|N/A|13463|251356|__
-video|1|149564|1.661822|145964|1.621822|3600|0.040000|N/A|N/A|12412|266020|__
-video|1|153164|1.701822|149564|1.661822|3600|0.040000|N/A|N/A|13469|279744|__
-audio|0|123897|1.376633|123897|1.376633|2351|0.026122|N/A|N/A|223|322608|K_
+video|1|120764|1.341822|117164|1.301822|3600|0.040000|N/A|N/A|14098|130096|__MPEGTS Stream ID|1
+
+video|1|124364|1.381822|120764|1.341822|3600|0.040000|N/A|N/A|13329|145324|__MPEGTS Stream ID|1
+
+video|1|127964|1.421822|124364|1.381822|3600|0.040000|N/A|N/A|12135|162996|__MPEGTS Stream ID|1
+
+video|1|131564|1.461822|127964|1.421822|3600|0.040000|N/A|N/A|12282|176344|__MPEGTS Stream ID|1
+
+video|1|135164|1.501822|131564|1.461822|3600|0.040000|N/A|N/A|24786|189692|K_MPEGTS Stream ID|1
+
+video|1|138764|1.541822|135164|1.501822|3600|0.040000|N/A|N/A|17440|216388|__MPEGTS Stream ID|1
+
+video|1|142364|1.581822|138764|1.541822|3600|0.040000|N/A|N/A|15019|235000|__MPEGTS Stream ID|1
+
+video|1|145964|1.621822|142364|1.581822|3600|0.040000|N/A|N/A|13449|251356|__MPEGTS Stream ID|1
+
+video|1|149564|1.661822|145964|1.621822|3600|0.040000|N/A|N/A|12398|266020|__MPEGTS Stream ID|1
+
+video|1|153164|1.701822|149564|1.661822|3600|0.040000|N/A|N/A|13455|279744|__MPEGTS Stream ID|1
+
+audio|0|123897|1.376633|123897|1.376633|2351|0.026122|N/A|N/A|209|322608|K_MPEGTS Stream ID|1
+
 audio|0|126248|1.402756|126248|1.402756|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|128599|1.428878|128599|1.428878|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|130950|1.455000|130950|1.455000|2351|0.026122|N/A|N/A|209|N/A|K_
@@ -108,12 +155,18 @@  audio|0|147407|1.637856|147407|1.637856|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|149758|1.663978|149758|1.663978|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|152109|1.690100|152109|1.690100|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|154460|1.716222|154460|1.716222|2351|0.026122|N/A|N/A|209|N/A|K_
-video|1|156764|1.741822|153164|1.701822|3600|0.040000|N/A|N/A|13850|294408|__
-video|1|160364|1.781822|156764|1.741822|3600|0.040000|N/A|N/A|12177|309448|__
-video|1|163964|1.821822|160364|1.781822|3600|0.040000|N/A|N/A|12706|325992|__
-video|1|167564|1.861822|163964|1.821822|3600|0.040000|N/A|N/A|10838|339528|__
-video|1|171164|1.901822|167564|1.861822|3600|0.040000|N/A|N/A|11300|351372|__
-audio|0|156811|1.742344|156811|1.742344|2351|0.026122|N/A|N/A|223|404576|K_
+video|1|156764|1.741822|153164|1.701822|3600|0.040000|N/A|N/A|13836|294408|__MPEGTS Stream ID|1
+
+video|1|160364|1.781822|156764|1.741822|3600|0.040000|N/A|N/A|12163|309448|__MPEGTS Stream ID|1
+
+video|1|163964|1.821822|160364|1.781822|3600|0.040000|N/A|N/A|12692|325992|__MPEGTS Stream ID|1
+
+video|1|167564|1.861822|163964|1.821822|3600|0.040000|N/A|N/A|10824|339528|__MPEGTS Stream ID|1
+
+video|1|171164|1.901822|167564|1.861822|3600|0.040000|N/A|N/A|11286|351372|__MPEGTS Stream ID|1
+
+audio|0|156811|1.742344|156811|1.742344|2351|0.026122|N/A|N/A|209|404576|K_MPEGTS Stream ID|1
+
 audio|0|159162|1.768467|159162|1.768467|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|161513|1.794589|161513|1.794589|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|163864|1.820711|163864|1.820711|2351|0.026122|N/A|N/A|209|N/A|K_
@@ -124,12 +177,17 @@  audio|0|173268|1.925200|173268|1.925200|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|175619|1.951322|175619|1.951322|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|177970|1.977444|177970|1.977444|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|180321|2.003567|180321|2.003567|2351|0.026122|N/A|N/A|209|N/A|K_
-video|1|174764|1.941822|171164|1.901822|3600|0.040000|N/A|N/A|12692|363592|__
+video|1|174764|1.941822|171164|1.901822|3600|0.040000|N/A|N/A|12678|363592|__MPEGTS Stream ID|1
+
 video|1|178364|1.981822|174764|1.941822|3600|0.040000|N/A|N/A|24711|377880|K_
-video|1|139582|1.550911|135982|1.510911|3600|0.040000|N/A|N/A|12706|325992|__
-video|1|143182|1.590911|139582|1.550911|3600|0.040000|N/A|N/A|10838|339528|__
-video|1|146782|1.630911|143182|1.590911|3600|0.040000|N/A|N/A|11300|351372|__
-audio|0|132429|1.471433|132429|1.471433|2351|0.026122|N/A|N/A|223|404576|K_
+video|1|139582|1.550911|135982|1.510911|3600|0.040000|N/A|N/A|12692|325992|__MPEGTS Stream ID|1
+
+video|1|143182|1.590911|139582|1.550911|3600|0.040000|N/A|N/A|10824|339528|__MPEGTS Stream ID|1
+
+video|1|146782|1.630911|143182|1.590911|3600|0.040000|N/A|N/A|11286|351372|__MPEGTS Stream ID|1
+
+audio|0|132429|1.471433|132429|1.471433|2351|0.026122|N/A|N/A|209|404576|K_MPEGTS Stream ID|1
+
 audio|0|134780|1.497556|134780|1.497556|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|137131|1.523678|137131|1.523678|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|139482|1.549800|139482|1.549800|2351|0.026122|N/A|N/A|209|N/A|K_
@@ -140,12 +198,18 @@  audio|0|148886|1.654289|148886|1.654289|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|151237|1.680411|151237|1.680411|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|153588|1.706533|153588|1.706533|2351|0.026122|N/A|N/A|209|N/A|K_
 audio|0|155939|1.732656|155939|1.732656|2351|0.026122|N/A|N/A|209|N/A|K_
-video|1|150382|1.670911|146782|1.630911|3600|0.040000|N/A|N/A|12692|363592|__
+video|1|150382|1.670911|146782|1.630911|3600|0.040000|N/A|N/A|12678|363592|__MPEGTS Stream ID|1
+
 video|1|153982|1.710911|150382|1.670911|3600|0.040000|N/A|N/A|24711|377880|K_
-video|1|161182|1.790911|157582|1.750911|3600|0.040000|N/A|N/A|12149|162996|__
-video|1|164782|1.830911|161182|1.790911|3600|0.040000|N/A|N/A|12296|176344|__
-video|1|168382|1.870911|164782|1.830911|3600|0.040000|N/A|N/A|24800|189692|K_
-video|1|171982|1.910911|168382|1.870911|3600|0.040000|N/A|N/A|17454|216388|__
-video|1|175582|1.950911|171982|1.910911|3600|0.040000|N/A|N/A|15033|235000|__
+video|1|161182|1.790911|157582|1.750911|3600|0.040000|N/A|N/A|12135|162996|__MPEGTS Stream ID|1
+
+video|1|164782|1.830911|161182|1.790911|3600|0.040000|N/A|N/A|12282|176344|__MPEGTS Stream ID|1
+
+video|1|168382|1.870911|164782|1.830911|3600|0.040000|N/A|N/A|24786|189692|K_MPEGTS Stream ID|1
+
+video|1|171982|1.910911|168382|1.870911|3600|0.040000|N/A|N/A|17440|216388|__MPEGTS Stream ID|1
+
+video|1|175582|1.950911|171982|1.910911|3600|0.040000|N/A|N/A|15019|235000|__MPEGTS Stream ID|1
+
 0|mp2|unknown|audio|1/44100|[3][0][0][0]|0x0003|s16p|44100|1|mono|0|N/A|0/0|0/0|1/90000|0|0.000000|N/A|N/A|64000|N/A|N/A|N/A|N/A|89|0|0|0|0|0|0|0|0|0|0|0|0
 1|mpeg2video|4|video|1/25|[2][0][0][0]|0x0002|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/90000|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|60|0|0|0|0|0|0|0|0|0|0|0|0
diff --git a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
index 789681fb82..a06fbba0fc 100644
--- a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
+++ b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
@@ -7,14 +7,14 @@  duration_ts=103326
 start_time=0.000000
 duration=2.367000
 [/FORMAT]
-packet|pts=-1024|dts=-1024|duration=1024
+packet|pts=-1024|dts=-1024|duration=1024side_data|
+
 packet|pts=0|dts=0|duration=1024
 packet|pts=1024|dts=1024|duration=1024
 packet|pts=2048|dts=2048|duration=1024
 packet|pts=3072|dts=3072|duration=1024
 packet|pts=4096|dts=4096|duration=1024
 packet|pts=5120|dts=5120|duration=1024
-packet|pts=6144|dts=6144|duration=1024
 packet|pts=95232|dts=95232|duration=1024
 packet|pts=96256|dts=96256|duration=1024
 packet|pts=97280|dts=97280|duration=1024
diff --git a/tests/ref/fate/gaplessenc-pcm-to-mov-aac b/tests/ref/fate/gaplessenc-pcm-to-mov-aac
index 8702611abd..305d78e9b6 100644
--- a/tests/ref/fate/gaplessenc-pcm-to-mov-aac
+++ b/tests/ref/fate/gaplessenc-pcm-to-mov-aac
@@ -7,14 +7,14 @@  duration_ts=529200
 start_time=0.000000
 duration=12.024000
 [/FORMAT]
-packet|pts=-1024|dts=-1024|duration=1024
+packet|pts=-1024|dts=-1024|duration=1024side_data|
+
 packet|pts=0|dts=0|duration=1024
 packet|pts=1024|dts=1024|duration=1024
 packet|pts=2048|dts=2048|duration=1024
 packet|pts=3072|dts=3072|duration=1024
 packet|pts=4096|dts=4096|duration=1024
 packet|pts=5120|dts=5120|duration=1024
-packet|pts=6144|dts=6144|duration=1024
 packet|pts=521216|dts=521216|duration=1024
 packet|pts=522240|dts=522240|duration=1024
 packet|pts=523264|dts=523264|duration=1024
diff --git a/tests/ref/fate/gaplessinfo-itunes1 b/tests/ref/fate/gaplessinfo-itunes1
index 717a2a8adf..01cefdc461 100644
--- a/tests/ref/fate/gaplessinfo-itunes1
+++ b/tests/ref/fate/gaplessinfo-itunes1
@@ -7,14 +7,14 @@  duration_ts=1294336
 start_time=0.047889
 duration=29.350023
 [/FORMAT]
-packet|pts=0|dts=0|duration=1024
+packet|pts=0|dts=0|duration=1024side_data|
+
 packet|pts=1024|dts=1024|duration=1024
 packet|pts=2048|dts=2048|duration=1024
 packet|pts=3072|dts=3072|duration=1024
 packet|pts=4096|dts=4096|duration=1024
 packet|pts=5120|dts=5120|duration=1024
 packet|pts=6144|dts=6144|duration=1024
-packet|pts=7168|dts=7168|duration=1024
 packet|pts=1286144|dts=1286144|duration=1024
 packet|pts=1287168|dts=1287168|duration=1024
 packet|pts=1288192|dts=1288192|duration=1024
diff --git a/tests/ref/fate/gaplessinfo-itunes2 b/tests/ref/fate/gaplessinfo-itunes2
index be15113df7..8bdc5166b5 100644
--- a/tests/ref/fate/gaplessinfo-itunes2
+++ b/tests/ref/fate/gaplessinfo-itunes2
@@ -7,14 +7,14 @@  duration_ts=105472
 start_time=0.047891
 duration=2.391655
 [/FORMAT]
-packet|pts=0|dts=0|duration=1024
+packet|pts=0|dts=0|duration=1024side_data|
+
 packet|pts=1024|dts=1024|duration=1024
 packet|pts=2048|dts=2048|duration=1024
 packet|pts=3072|dts=3072|duration=1024
 packet|pts=4096|dts=4096|duration=1024
 packet|pts=5120|dts=5120|duration=1024
 packet|pts=6144|dts=6144|duration=1024
-packet|pts=7168|dts=7168|duration=1024
 packet|pts=97280|dts=97280|duration=1024
 packet|pts=98304|dts=98304|duration=1024
 packet|pts=99328|dts=99328|duration=1024
diff --git a/tests/ref/fate/mov-aac-2048-priming b/tests/ref/fate/mov-aac-2048-priming
index d5ae31eb91..57e12f203d 100644
--- a/tests/ref/fate/mov-aac-2048-priming
+++ b/tests/ref/fate/mov-aac-2048-priming
@@ -1,4 +1,5 @@ 
-packet|codec_type=audio|stream_index=0|pts=-2048|pts_time=-0.046440|dts=-2048|dts_time=-0.046440|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=281|pos=36|flags=KD
+packet|codec_type=audio|stream_index=0|pts=-2048|pts_time=-0.046440|dts=-2048|dts_time=-0.046440|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=258|pos=36|flags=KDside_data|
+
 packet|codec_type=audio|stream_index=0|pts=-1024|pts_time=-0.023220|dts=-1024|dts_time=-0.023220|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=258|pos=294|flags=KD
 packet|codec_type=audio|stream_index=0|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=146|pos=552|flags=K_
 packet|codec_type=audio|stream_index=0|pts=1024|pts_time=0.023220|dts=1024|dts_time=0.023220|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=186|pos=698|flags=K_
diff --git a/tests/ref/seek/cache-pipe b/tests/ref/seek/cache-pipe
index b6a42e84d8..ebe5946601 100644
--- a/tests/ref/seek/cache-pipe
+++ b/tests/ref/seek/cache-pipe
@@ -1,6 +1,6 @@ 
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st:-1 flags:1  ts: 1.894167
 ret: 0         st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos:  31544 size:   418
 ret: 0         st: 0 flags:0  ts: 0.788334
@@ -18,7 +18,7 @@  ret: 0         st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos:  36141 size:   418
 ret: 0         st:-1 flags:1  ts: 1.047503
 ret: 0         st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos:  18169 size:   418
 ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st: 0 flags:1  ts: 2.835837
 ret: 0         st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos:  46590 size:   418
 ret: 0         st:-1 flags:0  ts: 1.730004
@@ -26,7 +26,7 @@  ret: 0         st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos:  29454 size:   418
 ret: 0         st:-1 flags:1  ts: 0.624171
 ret: 0         st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos:  11064 size:   418
 ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st: 0 flags:1  ts: 2.412505
 ret: 0         st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos:  39903 size:   418
 ret: 0         st:-1 flags:0  ts: 1.306672
@@ -34,7 +34,7 @@  ret: 0         st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos:  22766 size:   418
 ret: 0         st:-1 flags:1  ts: 0.200839
 ret: 0         st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos:   4376 size:   418
 ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st: 0 flags:1  ts: 1.989173
 ret: 0         st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos:  33215 size:   418
 ret: 0         st:-1 flags:0  ts: 0.883340
diff --git a/tests/ref/seek/extra-mp3 b/tests/ref/seek/extra-mp3
index 981ac02ca8..fdfb1a7c66 100644
--- a/tests/ref/seek/extra-mp3
+++ b/tests/ref/seek/extra-mp3
@@ -1,12 +1,12 @@ 
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st:-1 flags:1  ts: 1.894167
 ret: 0         st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos:  31544 size:   418
 ret: 0         st: 0 flags:0  ts: 0.788334
 ret: 0         st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos:  14407 size:   418
 ret: 0         st: 0 flags:1  ts:-0.317499
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st:-1 flags:0  ts: 2.576668
 ret: 0         st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos:  42828 size:   418
 ret: 0         st:-1 flags:1  ts: 1.470835
@@ -14,13 +14,13 @@  ret: 0         st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos:  24856 size:   418
 ret: 0         st: 0 flags:0  ts: 0.365002
 ret: 0         st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos:   7302 size:   418
 ret: 0         st: 0 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st:-1 flags:0  ts: 2.153336
 ret: 0         st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos:  36141 size:   418
 ret: 0         st:-1 flags:1  ts: 1.047503
 ret: 0         st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos:  18169 size:   418
 ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st: 0 flags:1  ts: 2.835837
 ret: 0         st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos:  46590 size:   418
 ret: 0         st:-1 flags:0  ts: 1.730004
@@ -28,7 +28,7 @@  ret: 0         st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos:  29454 size:   418
 ret: 0         st:-1 flags:1  ts: 0.624171
 ret: 0         st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos:  11064 size:   418
 ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st: 0 flags:1  ts: 2.412505
 ret: 0         st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos:  39903 size:   418
 ret: 0         st:-1 flags:0  ts: 1.306672
@@ -36,13 +36,13 @@  ret: 0         st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos:  22766 size:   418
 ret: 0         st:-1 flags:1  ts: 0.200839
 ret: 0         st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos:   4376 size:   418
 ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st: 0 flags:1  ts: 1.989173
 ret: 0         st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos:  33215 size:   418
 ret: 0         st:-1 flags:0  ts: 0.883340
 ret: 0         st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos:  15661 size:   418
 ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
 ret: 0         st: 0 flags:0  ts: 2.671674
 ret: 0         st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos:  44500 size:   418
 ret: 0         st: 0 flags:1  ts: 1.565841
@@ -50,4 +50,4 @@  ret: 0         st: 0 flags:1 dts: 1.567347 pts: 1.567347 pos:  26528 size:   418
 ret: 0         st:-1 flags:0  ts: 0.460008
 ret: 0         st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos:   8974 size:   418
 ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   440
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   1451 size:   417
diff --git a/tests/ref/seek/lavf-ts b/tests/ref/seek/lavf-ts
index f9808242f0..e57651ef9c 100644
--- a/tests/ref/seek/lavf-ts
+++ b/tests/ref/seek/lavf-ts
@@ -1,53 +1,53 @@ 
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.920000 pos: 189692 size: 24800
+ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.920000 pos: 189692 size: 24786
 ret: 0         st: 0 flags:0  ts: 0.788333
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st: 0 flags:1  ts:-0.317500
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st: 1 flags:0  ts: 2.576667
-ret: 0         st: 1 flags:1 dts: 2.160522 pts: 2.160522 pos: 404576 size:   223
+ret: 0         st: 1 flags:1 dts: 2.160522 pts: 2.160522 pos: 404576 size:   209
 ret: 0         st: 1 flags:1  ts: 1.470833
-ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   222
+ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   208
 ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st: 0 flags:0  ts: 2.153333
-ret: 0         st: 1 flags:1 dts: 1.794811 pts: 1.794811 pos: 322608 size:   223
+ret: 0         st: 1 flags:1 dts: 1.794811 pts: 1.794811 pos: 322608 size:   209
 ret: 0         st: 0 flags:1  ts: 1.047500
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st: 1 flags:0  ts:-0.058333
-ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   222
+ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   208
 ret: 0         st: 1 flags:1  ts: 2.835833
-ret: 0         st: 1 flags:1 dts: 2.160522 pts: 2.160522 pos: 404576 size:   223
+ret: 0         st: 1 flags:1 dts: 2.160522 pts: 2.160522 pos: 404576 size:   209
 ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   222
+ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   208
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st: 0 flags:0  ts:-0.481667
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st: 0 flags:1  ts: 2.412500
-ret: 0         st: 1 flags:1 dts: 2.160522 pts: 2.160522 pos: 404576 size:   223
+ret: 0         st: 1 flags:1 dts: 2.160522 pts: 2.160522 pos: 404576 size:   209
 ret: 0         st: 1 flags:0  ts: 1.306667
-ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   222
+ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   208
 ret: 0         st: 1 flags:1  ts: 0.200844
-ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   222
+ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   208
 ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:0 dts: 1.960000 pts: 2.000000 pos: 235000 size: 15033
+ret: 0         st: 0 flags:0 dts: 1.960000 pts: 2.000000 pos: 235000 size: 15019
 ret: 0         st: 0 flags:0  ts: 0.883344
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st: 0 flags:1  ts:-0.222489
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st: 1 flags:0  ts: 2.671678
-ret: 0         st: 1 flags:1 dts: 2.160522 pts: 2.160522 pos: 404576 size:   223
+ret: 0         st: 1 flags:1 dts: 2.160522 pts: 2.160522 pos: 404576 size:   209
 ret: 0         st: 1 flags:1  ts: 1.565844
-ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   222
+ret: 0         st: 1 flags:1 dts: 1.429089 pts: 1.429089 pos: 159988 size:   208
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
 ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24815
+ret: 0         st: 0 flags:1 dts: 1.400000 pts: 1.440000 pos:    564 size: 24801
diff --git a/tests/ref/seek/mkv-codec-delay b/tests/ref/seek/mkv-codec-delay
index 9d4582c139..04561eb876 100644
--- a/tests/ref/seek/mkv-codec-delay
+++ b/tests/ref/seek/mkv-codec-delay
@@ -2,46 +2,46 @@  ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
 ret: 0         st:-1 flags:0  ts:-1.000000
 ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   268
 ret: 0         st: 0 flags:0  ts: 0.788000
 ret: 0         st: 0 flags:1 dts: 0.794000 pts: 0.794000 pos:   7358 size:   154
 ret: 0         st: 0 flags:1  ts:-0.317000
 ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
 ret:-1         st:-1 flags:0  ts: 2.576668
 ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   268
 ret: 0         st: 0 flags:0  ts: 0.365000
 ret: 0         st: 0 flags:1 dts: 0.374000 pts: 0.374000 pos:   3963 size:   150
 ret: 0         st: 0 flags:1  ts:-0.741000
 ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
 ret:-1         st:-1 flags:0  ts: 2.153336
 ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   268
 ret: 0         st: 0 flags:0  ts:-0.058000
 ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
 ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   268
 ret:-1         st:-1 flags:0  ts: 1.730004
 ret: 0         st:-1 flags:1  ts: 0.624171
 ret: 0         st: 0 flags:1 dts: 0.614000 pts: 0.614000 pos:   5903 size:   159
 ret: 0         st: 0 flags:0  ts:-0.482000
 ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
 ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   268
 ret:-1         st:-1 flags:0  ts: 1.306672
 ret: 0         st:-1 flags:1  ts: 0.200839
 ret: 0         st: 0 flags:1 dts: 0.194000 pts: 0.194000 pos:   2512 size:   159
 ret: 0         st: 0 flags:0  ts:-0.905000
 ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
 ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   268
 ret: 0         st:-1 flags:0  ts: 0.883340
 ret: 0         st: 0 flags:1 dts: 0.894000 pts: 0.894000 pos:   8154 size:   155
 ret: 0         st:-1 flags:1  ts:-0.222493
 ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
 ret:-1         st: 0 flags:0  ts: 2.672000
 ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   268
 ret: 0         st:-1 flags:0  ts: 0.460008
 ret: 0         st: 0 flags:1 dts: 0.474000 pts: 0.474000 pos:   4768 size:   153
 ret: 0         st:-1 flags:1  ts:-0.645825