summaryrefslogtreecommitdiffstats
path: root/video/filter
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-17 18:22:35 +0100
committerwm4 <wm4@nowhere>2014-03-17 18:22:35 +0100
commit49d13f76ca727488de8622a8d176b5f71853bc61 (patch)
tree03a8a9f3ae0d2372075f563ad4220fc571f81e38 /video/filter
parent31fc5e85636f8e7b3bec5f133cb82b78e3c86ddb (diff)
downloadmpv-49d13f76ca727488de8622a8d176b5f71853bc61.tar.bz2
mpv-49d13f76ca727488de8622a8d176b5f71853bc61.tar.xz
vaapi: make struct va_surface private
It's not really needed to be public. Other code can just use mp_image. The only disadvantage is that the other code needs to call an accessor to get the VASurfaceID.
Diffstat (limited to 'video/filter')
-rw-r--r--video/filter/vf_vavpp.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c
index a1a7d3adf0..9a797990eb 100644
--- a/video/filter/vf_vavpp.c
+++ b/video/filter/vf_vavpp.c
@@ -123,11 +123,12 @@ static inline int get_deint_field(struct vf_priv_s *p, int i,
return !!(mpi->fields & MP_IMGFIELD_TOP_FIRST) ^ i ? VA_TOP_FIELD : VA_BOTTOM_FIELD;
}
-static struct mp_image *render(struct vf_instance *vf, struct va_surface *in,
+static struct mp_image *render(struct vf_instance *vf, struct mp_image *in,
unsigned int flags)
{
struct vf_priv_s *p = vf->priv;
- if (!p->pipe.filters || !in)
+ VASurfaceID in_id = va_surface_id(in);
+ if (!p->pipe.filters || in_id == VA_INVALID_ID)
return NULL;
struct mp_image *img = mp_image_pool_get(p->pool, IMGFMT_VAAPI, in->w, in->h);
if (!img)
@@ -135,7 +136,7 @@ static struct mp_image *render(struct vf_instance *vf, struct va_surface *in,
enum {Begun = 1, Rendered = 2};
int state = 0;
do { // not a loop, just for break
- VASurfaceID id = va_surface_id_in_mp_image(img);
+ VASurfaceID id = va_surface_id(img);
if (id == VA_INVALID_ID)
break;
VAStatus status = vaBeginPicture(p->display, p->context, id);
@@ -152,7 +153,7 @@ static struct mp_image *render(struct vf_instance *vf, struct va_surface *in,
status = vaMapBuffer(p->display, buffer, (void**)&param);
if (!check_error(vf, status, "vaMapBuffer()"))
break;
- param->surface = in->id;
+ param->surface = in_id;
param->surface_region = NULL;
param->output_region = NULL;
param->output_background_color = 0;
@@ -185,10 +186,9 @@ static int process(struct vf_instance *vf, struct mp_image *in,
const bool deint = p->do_deint && p->deint_type > 0;
if (!update_pipeline(vf, deint) || !p->pipe.filters) // no filtering
return 0;
- struct va_surface *surface = va_surface_in_mp_image(in);
const unsigned int csp = va_get_colorspace_flag(p->params.colorspace);
const unsigned int field = get_deint_field(p, 0, in);
- *out1 = render(vf, surface, field | csp);
+ *out1 = render(vf, in, field | csp);
if (!*out1) // cannot render
return 0;
mp_image_copy_attributes(*out1, in);
@@ -197,7 +197,7 @@ static int process(struct vf_instance *vf, struct mp_image *in,
const double add = (in->pts - p->prev_pts)*0.5;
if (p->prev_pts == MP_NOPTS_VALUE || add <= 0.0 || add > 0.5) // no pts, skip it
return 1;
- *out2 = render(vf, surface, get_deint_field(p, 1, in) | csp);
+ *out2 = render(vf, in, get_deint_field(p, 1, in) | csp);
if (!*out2) // cannot render
return 1;
mp_image_copy_attributes(*out2, in);
@@ -211,7 +211,7 @@ static struct mp_image *upload(struct vf_instance *vf, struct mp_image *in)
struct mp_image *out = mp_image_pool_get(p->pool, IMGFMT_VAAPI, in->w, in->h);
if (!out)
return NULL;
- if (va_surface_upload_image(out, in) < 0) {
+ if (va_surface_upload(out, in) < 0) {
talloc_free(out);
return NULL;
}
@@ -222,15 +222,15 @@ static struct mp_image *upload(struct vf_instance *vf, struct mp_image *in)
static int filter_ext(struct vf_instance *vf, struct mp_image *in)
{
struct vf_priv_s *p = vf->priv;
- struct va_surface *surface = va_surface_in_mp_image(in);
- const int rt_format = surface ? surface->rt_format : VA_RT_FORMAT_YUV420;
+ int rt_format = in->imgfmt == IMGFMT_VAAPI ? va_surface_rt_format(in)
+ : VA_RT_FORMAT_YUV420;
if (!p->pool || p->current_rt_format != rt_format) {
talloc_free(p->pool);
p->pool = mp_image_pool_new(20);
va_pool_set_allocator(p->pool, p->va, rt_format);
p->current_rt_format = rt_format;
}
- if (!surface) {
+ if (in->imgfmt != IMGFMT_VAAPI) {
struct mp_image *tmp = upload(vf, in);
talloc_free(in);
in = tmp;