summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavformat/mpegenc.c10
-rw-r--r--tests/ref/lavf/mpg2
-rw-r--r--tests/ref/seek/lavf_mpg54
3 files changed, 34 insertions, 32 deletions
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index affc801b4a..5c090f63b0 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -1162,11 +1162,13 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
pts= pkt->pts;
dts= pkt->dts;
- if(!s->last_scr)
- s->last_scr= dts;
- if(pts != AV_NOPTS_VALUE) pts += preload;
- if(dts != AV_NOPTS_VALUE) dts += preload;
+ if(pts != AV_NOPTS_VALUE) pts += 2*preload;
+ if(dts != AV_NOPTS_VALUE){
+ if(!s->last_scr)
+ s->last_scr= dts + preload;
+ dts += 2*preload;
+ }
//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE);
if (!stream->premux_packet)
diff --git a/tests/ref/lavf/mpg b/tests/ref/lavf/mpg
index 2f5b3a7eb0..13f95a0f1a 100644
--- a/tests/ref/lavf/mpg
+++ b/tests/ref/lavf/mpg
@@ -1,3 +1,3 @@
-eed66277633e53724e58e3fca2709f41 *./tests/data/lavf/lavf.mpg
+dd60652c2193670abffb8c2a123a820e *./tests/data/lavf/lavf.mpg
372736 ./tests/data/lavf/lavf.mpg
./tests/data/lavf/lavf.mpg CRC=0x2b39ed74
diff --git a/tests/ref/seek/lavf_mpg b/tests/ref/seek/lavf_mpg
index 4f078649fb..dc51195293 100644
--- a/tests/ref/seek/lavf_mpg
+++ b/tests/ref/seek/lavf_mpg
@@ -1,53 +1,53 @@
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size: 681
+ret: 0 st: 0 flags:0 dts: 1.880000 pts: 1.920000 pos: 327680 size: 12894
ret: 0 st: 0 flags:0 ts: 0.788333
-ret: 0 st: 1 flags:1 dts: 0.761222 pts: 0.761222 pos: 145408 size: 261
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st: 0 flags:1 ts:-0.317500
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st: 1 flags:0 ts: 2.576667
-ret: 0 st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size: 235
+ret: 0 st: 1 flags:1 dts: 2.018778 pts: 2.018778 pos: 370700 size: 235
ret: 0 st: 1 flags:1 ts: 1.470833
-ret: 0 st: 1 flags:1 dts: 1.283678 pts: 1.283678 pos: 368652 size: 379
+ret: 0 st: 1 flags:1 dts: 1.261222 pts: 1.261222 pos: 145408 size: 261
ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st: 0 flags:0 ts: 2.153333
-ret: 0 st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size: 681
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681
ret: 0 st: 0 flags:1 ts: 1.047500
-ret: 0 st: 0 flags:0 dts: 1.020000 pts: 1.060000 pos: 212992 size: 16484
+ret: 0 st: 0 flags:0 dts: 1.040000 pts: 1.080000 pos: 40960 size: 16073
ret: 0 st: 1 flags:0 ts:-0.058333
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st: 1 flags:1 ts: 2.835833
-ret: 0 st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size: 235
+ret: 0 st: 1 flags:1 dts: 2.018778 pts: 2.018778 pos: 370700 size: 235
ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size: 681
+ret: 0 st: 0 flags:0 dts: 1.760000 pts: 1.800000 pos: 292864 size: 13170
ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:0 dts: 0.620000 pts: 0.660000 pos: 67584 size: 15804
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st: 0 flags:0 ts:-0.481667
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st: 0 flags:1 ts: 2.412500
-ret: 0 st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size: 681
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681
ret: 0 st: 1 flags:0 ts: 1.306667
-ret: 0 st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size: 235
+ret: 0 st: 1 flags:1 dts: 1.522444 pts: 1.522444 pos: 342028 size: 314
ret: 0 st: 1 flags:1 ts: 0.200844
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st:-1 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size: 681
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681
ret: 0 st: 0 flags:0 ts: 0.883344
-ret: 0 st: 0 flags:0 dts: 0.900000 pts: 0.940000 pos: 159744 size: 12809
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st: 0 flags:1 ts:-0.222489
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st: 1 flags:0 ts: 2.671678
-ret: 0 st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size: 235
+ret: 0 st: 1 flags:1 dts: 2.018778 pts: 2.018778 pos: 370700 size: 235
ret: 0 st: 1 flags:1 ts: 1.565844
-ret: 0 st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size: 235
+ret: 0 st: 1 flags:1 dts: 1.522444 pts: 1.522444 pos: 342028 size: 314
ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:0 dts: 0.500000 pts: 0.540000 pos: 26624 size: 16303
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208