[FFmpeg-cvslog] avformat/yuv4mpegdec: fix seeking for partial files

Paul B Mahol git at videolan.org
Thu Mar 3 09:28:41 CET 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Mar  2 20:56:01 2016 +0100| [dd2ea5cbfb30a0a2ff112d6e48adc42a30484fe9] | committer: Paul B Mahol

avformat/yuv4mpegdec: fix seeking for partial files

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd2ea5cbfb30a0a2ff112d6e48adc42a30484fe9
---

 libavformat/yuv4mpegdec.c    |    3 ++-
 tests/ref/seek/lavf-yuv4mpeg |   24 ++++++++----------------
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
index ea1ae25..db07566 100644
--- a/libavformat/yuv4mpegdec.c
+++ b/libavformat/yuv4mpegdec.c
@@ -307,7 +307,8 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
 static int yuv4_read_seek(AVFormatContext *s, int stream_index,
                           int64_t pts, int flags)
 {
-    avio_seek(s->pb, pts * s->packet_size + s->internal->data_offset, SEEK_SET);
+    if (avio_seek(s->pb, pts * s->packet_size + s->internal->data_offset, SEEK_SET) < 0)
+        return -1;
     return 0;
 }
 
diff --git a/tests/ref/seek/lavf-yuv4mpeg b/tests/ref/seek/lavf-yuv4mpeg
index 60c3036..6be9ba9 100644
--- a/tests/ref/seek/lavf-yuv4mpeg
+++ b/tests/ref/seek/lavf-yuv4mpeg
@@ -1,53 +1,45 @@
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     64 size:152064
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.040000 pts: 0.040000 pos: 152134 size:152064
+ret:-1         st:-1 flags:0  ts:-1.000000
 ret: 0         st:-1 flags:1  ts: 1.894167
 ret:-EOF
 ret: 0         st: 0 flags:0  ts: 0.800000
 ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:3041464 size:152064
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.840000 pts: 0.840000 pos:3193534 size:152064
+ret:-1         st: 0 flags:1  ts:-0.320000
 ret: 0         st:-1 flags:0  ts: 2.576668
 ret:-EOF
 ret: 0         st:-1 flags:1  ts: 1.470835
 ret:-EOF
 ret: 0         st: 0 flags:0  ts: 0.360000
 ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1368694 size:152064
-ret: 0         st: 0 flags:1  ts:-0.760000
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: 0.400000 pos:1520764 size:152064
+ret:-1         st: 0 flags:1  ts:-0.760000
 ret: 0         st:-1 flags:0  ts: 2.153336
 ret:-EOF
 ret: 0         st:-1 flags:1  ts: 1.047503
 ret:-EOF
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret:-EOF
+ret:-1         st: 0 flags:0  ts:-0.040000
 ret: 0         st: 0 flags:1  ts: 2.840000
 ret:-EOF
 ret: 0         st:-1 flags:0  ts: 1.730004
 ret:-EOF
 ret: 0         st:-1 flags:1  ts: 0.624171
 ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:2433184 size:152064
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.680000 pts: 0.680000 pos:2585254 size:152064
+ret:-1         st: 0 flags:0  ts:-0.480000
 ret: 0         st: 0 flags:1  ts: 2.400000
 ret:-EOF
 ret: 0         st:-1 flags:0  ts: 1.306672
 ret:-EOF
 ret: 0         st:-1 flags:1  ts: 0.200839
 ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 760414 size:152064
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.240000 pts: 0.240000 pos: 912484 size:152064
+ret:-1         st: 0 flags:0  ts:-0.920000
 ret: 0         st: 0 flags:1  ts: 2.000000
 ret:-EOF
 ret: 0         st:-1 flags:0  ts: 0.883340
 ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:3345604 size:152064
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.920000 pts: 0.920000 pos:3497674 size:152064
+ret:-1         st:-1 flags:1  ts:-0.222493
 ret: 0         st: 0 flags:0  ts: 2.680000
 ret:-EOF
 ret: 0         st: 0 flags:1  ts: 1.560000
 ret:-EOF
 ret: 0         st:-1 flags:0  ts: 0.460008
 ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1824904 size:152064
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.520000 pts: 0.520000 pos:1976974 size:152064
+ret:-1         st:-1 flags:1  ts:-0.645825



More information about the ffmpeg-cvslog mailing list