summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-17 12:07:43 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-17 12:07:43 +0100
commit206f8fd36fe120beb8358ea2cf1e8164fe661df3 (patch)
tree87f62e1ae53070497064163a51aa740762e7820f
parentd8773bd96bf1d9e00fcc15bcf551e810b26a7378 (diff)
downloadadvtime-206f8fd36fe120beb8358ea2cf1e8164fe661df3.tar.gz
advtime-206f8fd36fe120beb8358ea2cf1e8164fe661df3.tar.bz2
advtime-206f8fd36fe120beb8358ea2cf1e8164fe661df3.zip
video_decode: Use av_strerror to get an error message if read_frame fails
-rw-r--r--src/video_decode.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/video_decode.c b/src/video_decode.c
index 1124d72..b3c8e4d 100644
--- a/src/video_decode.c
+++ b/src/video_decode.c
@@ -5,6 +5,7 @@
#include "video_decode.h"
#include <libavutil/avutil.h>
+#include <libavutil/error.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
@@ -114,10 +115,16 @@ video_decode_get_frame(struct video_decode *vd, struct video_frame **frame)
av_free_packet(&packet);
ret = av_read_frame(vd->fmt_ctx, &packet);
if (ret < 0) {
- if (ret == AVERROR_EOF)
+ if (ret == AVERROR_EOF) {
return 0;
+ }
#if DEBUG
- fprintf(stderr, "Found no video stream packet!\n");
+ else {
+ char buf[BUFSIZ];
+ av_strerror(ret, buf, BUFSIZ);
+ fprintf(stderr,
+ "Failed to read frame: %s\n", buf);
+ }
#endif
return -1;
}