mirror of
https://github.com/mpv-player/mpv
synced 2024-12-26 00:42:57 +00:00
vdpau: remove legacy pixel formats
They were used by ancient libavcodec versions. This also removes the need to distinguish vdpau image formats at all (since there is only one), and some code can be simplified.
This commit is contained in:
parent
4e70335c2f
commit
6389507314
@ -146,7 +146,7 @@ static struct mp_image *allocate_image(struct lavc_ctx *ctx, int fmt,
|
||||
VdpChromaType chroma;
|
||||
mp_vdpau_get_format(IMGFMT_VDPAU, &chroma, NULL);
|
||||
|
||||
return mp_vdpau_get_video_surface(p->mpvdp, IMGFMT_VDPAU, chroma, w, h);
|
||||
return mp_vdpau_get_video_surface(p->mpvdp, chroma, w, h);
|
||||
}
|
||||
|
||||
static void uninit(struct lavc_ctx *ctx)
|
||||
|
@ -114,12 +114,6 @@ struct mp_imgfmt_entry mp_imgfmt_list[] = {
|
||||
FMT_ENDIAN("gbrp14", IMGFMT_GBRP14)
|
||||
FMT_ENDIAN("gbrp16", IMGFMT_GBRP16)
|
||||
FMT_ENDIAN("xyz12", IMGFMT_XYZ12)
|
||||
FMT("vdpau_mpeg1", IMGFMT_VDPAU_MPEG1)
|
||||
FMT("vdpau_mpeg2", IMGFMT_VDPAU_MPEG2)
|
||||
FMT("vdpau_h264", IMGFMT_VDPAU_H264)
|
||||
FMT("vdpau_wmv3", IMGFMT_VDPAU_WMV3)
|
||||
FMT("vdpau_vc1", IMGFMT_VDPAU_VC1)
|
||||
FMT("vdpau_mpeg4", IMGFMT_VDPAU_MPEG4)
|
||||
FMT("vdpau", IMGFMT_VDPAU)
|
||||
FMT("vda", IMGFMT_VDA)
|
||||
FMT("vaapi", IMGFMT_VAAPI)
|
||||
|
@ -252,20 +252,8 @@ enum mp_imgfmt {
|
||||
|
||||
// Hardware accelerated formats. Plane data points to special data
|
||||
// structures, instead of pixel data.
|
||||
|
||||
IMGFMT_VDPAU, // new decoder API
|
||||
IMGFMT_VDPAU_MPEG1, // old API
|
||||
IMGFMT_VDPAU_MPEG2,
|
||||
IMGFMT_VDPAU_H264,
|
||||
IMGFMT_VDPAU_WMV3,
|
||||
IMGFMT_VDPAU_VC1,
|
||||
IMGFMT_VDPAU_MPEG4,
|
||||
|
||||
IMGFMT_VDPAU_FIRST = IMGFMT_VDPAU,
|
||||
IMGFMT_VDPAU_LAST = IMGFMT_VDPAU_MPEG4,
|
||||
|
||||
IMGFMT_VDPAU,
|
||||
IMGFMT_VDA,
|
||||
|
||||
IMGFMT_VAAPI,
|
||||
|
||||
|
||||
@ -341,11 +329,8 @@ static inline bool IMGFMT_IS_RGB(int fmt)
|
||||
|
||||
#define IMGFMT_RGB_DEPTH(fmt) (mp_imgfmt_get_desc(fmt).plane_bits)
|
||||
|
||||
#define IMGFMT_IS_VDPAU(fmt) \
|
||||
(((fmt) >= IMGFMT_VDPAU_FIRST) && ((fmt) <= IMGFMT_VDPAU_LAST))
|
||||
|
||||
#define IMGFMT_IS_HWACCEL(fmt) \
|
||||
(IMGFMT_IS_VDPAU(fmt) || ((fmt) == IMGFMT_VAAPI) || ((fmt) == IMGFMT_VDA))
|
||||
((fmt) == IMGFMT_VDPAU || (fmt) == IMGFMT_VAAPI || (fmt) == IMGFMT_VDA)
|
||||
|
||||
|
||||
struct mp_imgfmt_entry {
|
||||
|
@ -1189,8 +1189,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
|
||||
"output_surface_put_bits_native");
|
||||
}
|
||||
} else {
|
||||
reserved_mpi = mp_vdpau_get_video_surface(vc->mpvdp, IMGFMT_VDPAU,
|
||||
vc->vdp_chroma_type,
|
||||
reserved_mpi = mp_vdpau_get_video_surface(vc->mpvdp, vc->vdp_chroma_type,
|
||||
mpi->w, mpi->h);
|
||||
if (!reserved_mpi)
|
||||
return;
|
||||
|
@ -140,26 +140,24 @@ static struct mp_image *create_ref(struct surface_entry *e)
|
||||
struct mp_image *res =
|
||||
mp_image_new_custom_ref(&(struct mp_image){0}, &e->in_use,
|
||||
release_decoder_surface);
|
||||
mp_image_setfmt(res, e->fmt);
|
||||
mp_image_setfmt(res, IMGFMT_VDPAU);
|
||||
mp_image_set_size(res, e->w, e->h);
|
||||
res->planes[0] = (void *)"dummy"; // must be non-NULL, otherwise arbitrary
|
||||
res->planes[3] = (void *)(intptr_t)e->surface;
|
||||
return res;
|
||||
}
|
||||
|
||||
struct mp_image *mp_vdpau_get_video_surface(struct mp_vdpau_ctx *ctx, int fmt,
|
||||
struct mp_image *mp_vdpau_get_video_surface(struct mp_vdpau_ctx *ctx,
|
||||
VdpChromaType chroma, int w, int h)
|
||||
{
|
||||
struct vdp_functions *vdp = ctx->vdp;
|
||||
VdpStatus vdp_st;
|
||||
|
||||
assert(IMGFMT_IS_VDPAU(fmt));
|
||||
|
||||
// Destroy all unused surfaces that don't have matching parameters
|
||||
for (int n = 0; n < MAX_VIDEO_SURFACES; n++) {
|
||||
struct surface_entry *e = &ctx->video_surfaces[n];
|
||||
if (!e->in_use && e->surface != VDP_INVALID_HANDLE) {
|
||||
if (e->fmt != fmt || e->chroma != chroma || e->w != w || e->h != h) {
|
||||
if (e->chroma != chroma || e->w != w || e->h != h) {
|
||||
vdp_st = vdp->video_surface_destroy(e->surface);
|
||||
CHECK_VDP_WARNING(ctx, "Error when calling vdp_video_surface_destroy");
|
||||
e->surface = VDP_INVALID_HANDLE;
|
||||
@ -172,7 +170,7 @@ struct mp_image *mp_vdpau_get_video_surface(struct mp_vdpau_ctx *ctx, int fmt,
|
||||
struct surface_entry *e = &ctx->video_surfaces[n];
|
||||
if (!e->in_use && e->surface != VDP_INVALID_HANDLE) {
|
||||
assert(e->w == w && e->h == h);
|
||||
assert(e->fmt == fmt && e->chroma == chroma);
|
||||
assert(e->chroma == chroma);
|
||||
return create_ref(e);
|
||||
}
|
||||
}
|
||||
@ -182,7 +180,6 @@ struct mp_image *mp_vdpau_get_video_surface(struct mp_vdpau_ctx *ctx, int fmt,
|
||||
struct surface_entry *e = &ctx->video_surfaces[n];
|
||||
if (!e->in_use) {
|
||||
assert(e->surface == VDP_INVALID_HANDLE);
|
||||
e->fmt = fmt;
|
||||
e->chroma = chroma;
|
||||
e->w = w;
|
||||
e->h = h;
|
||||
@ -265,12 +262,6 @@ bool mp_vdpau_get_format(int imgfmt, VdpChromaType *out_chroma_type,
|
||||
ycbcr = VDP_YCBCR_FORMAT_UYVY;
|
||||
chroma = VDP_CHROMA_TYPE_422;
|
||||
break;
|
||||
case IMGFMT_VDPAU_MPEG1:
|
||||
case IMGFMT_VDPAU_MPEG2:
|
||||
case IMGFMT_VDPAU_H264:
|
||||
case IMGFMT_VDPAU_WMV3:
|
||||
case IMGFMT_VDPAU_VC1:
|
||||
case IMGFMT_VDPAU_MPEG4:
|
||||
case IMGFMT_VDPAU:
|
||||
break;
|
||||
default:
|
||||
|
@ -49,7 +49,7 @@ struct mp_vdpau_ctx {
|
||||
// Surface pool
|
||||
struct surface_entry {
|
||||
VdpVideoSurface surface;
|
||||
int fmt, w, h;
|
||||
int w, h;
|
||||
VdpChromaType chroma;
|
||||
bool in_use;
|
||||
} video_surfaces[MAX_VIDEO_SURFACES];
|
||||
@ -63,7 +63,7 @@ void mp_vdpau_destroy(struct mp_vdpau_ctx *ctx);
|
||||
|
||||
bool mp_vdpau_status_ok(struct mp_vdpau_ctx *ctx);
|
||||
|
||||
struct mp_image *mp_vdpau_get_video_surface(struct mp_vdpau_ctx *ctx, int fmt,
|
||||
struct mp_image *mp_vdpau_get_video_surface(struct mp_vdpau_ctx *ctx,
|
||||
VdpChromaType chroma, int w, int h);
|
||||
|
||||
bool mp_vdpau_get_format(int imgfmt, VdpChromaType *out_chroma_type,
|
||||
|
Loading…
Reference in New Issue
Block a user