Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-05 03:49:25 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-10-05 03:55:54 +0400
commitb02e4faa3ef9384c7d6a307e518e6446b045fb98 (patch)
tree2f52594cf6c3be00aba205777c77c2bfde0a6d0e
parent09256527be47cc2b39d84aadfc74b8e51125f6a6 (diff)
avformat/img2dec: Support -loop with pipes
Fixes Ticket3976 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 684508ba15ca15d5d43f67bbed483ce5b6617f10) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/img2dec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 70bef9d405..ee484f6029 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -421,6 +421,8 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
infer_size(&codec->width, &codec->height, size[0]);
} else {
f[0] = s1->pb;
+ if (avio_feof(f[0]) && s->loop && s->is_pipe)
+ avio_seek(f[0], 0, SEEK_SET);
if (avio_feof(f[0]))
return AVERROR_EOF;
if (s->frame_size > 0) {
@@ -457,6 +459,12 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
for (i = 0; i < 3; i++) {
if (f[i]) {
ret[i] = avio_read(f[i], pkt->data + pkt->size, size[i]);
+ if (s->loop && s->is_pipe && ret[i] == AVERROR_EOF) {
+ if (avio_seek(f[i], 0, SEEK_SET) >= 0) {
+ pkt->pos = 0;
+ ret[i] = avio_read(f[i], pkt->data + pkt->size, size[i]);
+ }
+ }
if (!s->is_pipe)
avio_close(f[i]);
if (ret[i] > 0)