From 1e53308d65464599c0de60fa497cb3c05435a68f Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Tue, 15 Sep 2015 21:50:47 -0700 Subject: vf_vdpaurb: Pass through non-hardware-decoded content Today, vdpaurb will fail if it's used with non-hardware-decoded content. This created work for the user as they have to explicitly add or not add it, depending on the content. As an improvement, we can make vdpaurb pass through any frames that aren't hardware decoded, so that it can always be present in the filter chain, if desired. --- video/filter/vf_vdpaurb.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'video') diff --git a/video/filter/vf_vdpaurb.c b/video/filter/vf_vdpaurb.c index 8eaeb86e21..8f88838dda 100644 --- a/video/filter/vf_vdpaurb.c +++ b/video/filter/vf_vdpaurb.c @@ -44,6 +44,12 @@ static int filter_ext(struct vf_instance *vf, struct mp_image *mpi) return 0; } + // Pass-through anything that's not been decoded by VDPAU + if (mpi->imgfmt != IMGFMT_VDPAU) { + vf_add_output_frame(vf, mpi); + return 0; + } + if (mp_vdpau_mixed_frame_get(mpi)) { MP_ERR(vf, "Can't apply vdpaurb filter after vdpaupp filter.\n"); mp_image_unrefp(&mpi); @@ -75,14 +81,8 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in, struct mp_image_params *out) { *out = *in; - out->imgfmt = IMGFMT_NV12; - return 0; -} - -static int query_format(struct vf_instance *vf, unsigned int fmt) -{ - if (fmt == IMGFMT_VDPAU) { - return vf_next_query_format(vf, IMGFMT_NV12); + if (in->imgfmt == IMGFMT_VDPAU) { + out->imgfmt = IMGFMT_NV12; } return 0; } @@ -94,7 +94,6 @@ static int vf_open(vf_instance_t *vf) vf->filter_ext = filter_ext; vf->filter = NULL; vf->reconfig = reconfig; - vf->query_format = query_format; if (!vf->hwdec) { return 0; -- cgit v1.2.3