summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-28 19:50:32 +0200
committerwm4 <wm4@nowhere>2014-04-28 22:23:31 +0200
commitf39e4210f7b3afe163ee54f0238389fe26c124b8 (patch)
tree7ca0df0b77698969e10648a2cc352ed8f918d508 /video
parent42f65ce1083ca38605a8c775ee339cf0cc669cb8 (diff)
downloadmpv-f39e4210f7b3afe163ee54f0238389fe26c124b8.tar.bz2
mpv-f39e4210f7b3afe163ee54f0238389fe26c124b8.tar.xz
vf_lavfi: distinguish real errors from other states
Don't just hide real errors, should a filter return them.
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_lavfi.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c
index 8e446cec1d..f2de4fe9a4 100644
--- a/video/filter/vf_lavfi.c
+++ b/video/filter/vf_lavfi.c
@@ -30,6 +30,7 @@
#include <libavutil/rational.h>
#include <libavutil/pixdesc.h>
#include <libavutil/time.h>
+#include <libavutil/error.h>
#include <libswscale/swscale.h>
#include <libavfilter/avfilter.h>
#include <libavfilter/avfiltergraph.h>
@@ -298,13 +299,21 @@ static int filter_ext(struct vf_instance *vf, struct mp_image *mpi)
for (;;) {
frame = av_frame_alloc();
- if (av_buffersink_get_frame(p->out, frame) < 0) {
+ int err = av_buffersink_get_frame(p->out, frame);
+ if (err == AVERROR(EAGAIN) || err == AVERROR_EOF) {
// Not an error situation - no more output buffers in queue.
+ // AVERROR_EOF means we shouldn't even give the filter more
+ // input, but we don't handle that.
av_frame_free(&frame);
break;
}
- get_metadata_from_av_frame(vf,frame);
+ if (err < 0) {
+ av_frame_free(&frame);
+ MP_ERR(vf, "libavfilter error: %d\n", err);
+ return -1;
+ }
+ get_metadata_from_av_frame(vf, frame);
vf_add_output_frame(vf, av_to_mp(vf, frame));
}