]> granicus.if.org Git - handbrake/commitdiff
libav: fix EIO error when reaching EOF of DV files
authorJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 11 Jan 2017 19:27:38 +0000 (12:27 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 11 Jan 2017 19:28:38 +0000 (12:28 -0700)
(cherry picked from commit fbea656ef0a79757e77ecfa313bc009e21b28993)

contrib/ffmpeg/A04-dv-eof.patch [new file with mode: 0644]

diff --git a/contrib/ffmpeg/A04-dv-eof.patch b/contrib/ffmpeg/A04-dv-eof.patch
new file mode 100644 (file)
index 0000000..7afecff
--- /dev/null
@@ -0,0 +1,37 @@
+From 1f5593ff0a2d9fee94fe39aa52fb8a81d7383ebb Mon Sep 17 00:00:00 2001
+From: John Stebbins <stebbins@jetheaddev.com>
+Date: Wed, 11 Jan 2017 12:17:06 -0700
+Subject: [PATCH] dv: Don't return EIO upon EOF
+
+---
+ libavformat/dv.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/libavformat/dv.c b/libavformat/dv.c
+index d4e5180..7e52e42 100644
+--- a/libavformat/dv.c
++++ b/libavformat/dv.c
+@@ -478,7 +478,7 @@ static int dv_read_header(AVFormatContext *s)
+ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
+ {
+-    int size;
++    int size, result;
+     RawDVContext *c = s->priv_data;
+     size = avpriv_dv_get_packet(c->dv_demux, pkt);
+@@ -487,7 +487,10 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
+         if (!c->dv_demux->sys)
+             return AVERROR(EIO);
+         size = c->dv_demux->sys->frame_size;
+-        if (avio_read(s->pb, c->buf, size) <= 0)
++        result = avio_read(s->pb, c->buf, size);
++        if (result == AVERROR_EOF)
++            return result;
++        if (result <= 0)
+             return AVERROR(EIO);
+         size = avpriv_dv_produce_packet(c->dv_demux, pkt, c->buf, size);
+-- 
+2.9.3
+