path: root/player/video.c
diff options
authorwm4 <wm4@nowhere>2017-01-16 15:52:13 +0100
committerwm4 <wm4@nowhere>2017-01-16 16:10:39 +0100
commit1b1771f2a709269440ccbf2fdc27cc7f5bb7248a (patch)
treed89cd9d67598c5b3e4cb408a8c6fd9adf2eed07e /player/video.c
parent91fb7078e22864ece2b94bde350edd193c3fb279 (diff)
video: support filtering hardware frames via libavfilter
Requires a bunch of hacks: - we access AVFilterLink.hw_frames_ctx. This is not a public API in FFmpeg and Libav. Newer FFmpeg provides an accessor (av_buffersink_get_hw_frames_ctx), but it's not available in Libav or the current FFmpeg release or Libav. We need this value after filter graph creation, so We have no choice but to access this. One alternative is making filter creation and format negotiation fully lazy (i.e. delay it and do it as filters are output), but this would be a huge change. So for now, we knowingly violate FFmpeg's and Libav's ABI and API constraints because they don't provide anything better. On newer FFmpeg, we use the (quite ugly) accessor, though. - mp_image_params doesn't (and can't) have a field for the frames context AVBufferRef. So we pass it via vf_set_proto_frame(), and even more hacks. - if a filter needs a hw context, but we haven't created one yet (because normally we create them lazily), it will fail at init. - we allow any hw format now, although this could go horrible wrong. Why all this effort? We could move hw deinterlacing filters etc. to FFmpeg, which is a very worthy goal.
Diffstat (limited to 'player/video.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/player/video.c b/player/video.c
index 78d10fd107..79828aa6ce 100644
--- a/player/video.c
+++ b/player/video.c
@@ -701,6 +701,7 @@ static int video_decode_and_filter(struct MPContext *mpctx)
if (vo_c->input_mpi) {
vo_c->input_format = vo_c->input_mpi->params;
+ vf_set_proto_frame(vo_c->vf, vo_c->input_mpi);
if (vo_c->is_coverart && !vo_c->cached_coverart)
vo_c->cached_coverart = mp_image_new_ref(vo_c->input_mpi);