summaryrefslogtreecommitdiffstats
path: root/video/decode/vd.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-01-11 10:56:25 +0100
committerwm4 <wm4@nowhere>2017-01-11 11:02:57 +0100
commit77320ad45e3f1e6b08ecff4a3c0045a4864816a8 (patch)
tree9bcac59417990f8f496d3001cb7d479fb3c415d8 /video/decode/vd.h
parent902424d065bab52185fc2d0b177ce75012e71819 (diff)
downloadmpv-77320ad45e3f1e6b08ecff4a3c0045a4864816a8.tar.bz2
mpv-77320ad45e3f1e6b08ecff4a3c0045a4864816a8.tar.xz
video: make decoder EOF reporting explicit
This is simpler and more robust, especially for the hwdec fallback case. The most annoying issue is that C doesn't support multiple return values (or sum types), so the decode call gets all awkward. The hwdec fallback case does not need to try to produce some output after the fallback anymore. Instead, it can use the normal "replay" code path. We invert the "eof" bool that vd_lavc.c used internally. The receive_frame decoder API returns the inverse of EOF, because returning "true" from the decode function if EOF was reached feels awkward.
Diffstat (limited to 'video/decode/vd.h')
-rw-r--r--video/decode/vd.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/video/decode/vd.h b/video/decode/vd.h
index 4702b77860..3897eedc31 100644
--- a/video/decode/vd.h
+++ b/video/decode/vd.h
@@ -35,7 +35,9 @@ typedef struct vd_functions
int (*control)(struct dec_video *vd, int cmd, void *arg);
// Return whether or not the packet has been consumed.
bool (*send_packet)(struct dec_video *vd, struct demux_packet *pkt);
- struct mp_image *(*receive_frame)(struct dec_video *vd);
+ // Return whether decoding is still going on (false if EOF was reached).
+ // Never returns false & *out_image set, but can return true with no image.
+ bool (*receive_frame)(struct dec_video *vd, struct mp_image **out_image);
} vd_functions_t;
// NULL terminated array of all drivers