diff options
author | wm4 <wm4@nowhere> | 2014-05-22 20:55:17 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-05-22 20:59:31 +0200 |
commit | 7b7e15a460f2a24ba8c42f6caa71f1ca0ad25499 (patch) | |
tree | 3ed0a651606f334ec17a69b049689a0d2005659e /video/img_format.c | |
parent | dbed21cde451aed60e7e06b3c700234dcffd8012 (diff) | |
download | mpv-7b7e15a460f2a24ba8c42f6caa71f1ca0ad25499.tar.bz2 mpv-7b7e15a460f2a24ba8c42f6caa71f1ca0ad25499.tar.xz |
vdpau: move RGB surface management out of the VO
Integrate it with the existing surface allocator in vdpau.c. The changes
are a bit violent, because the vdpau API is so non-orthogonal: compared
to video surfaces, output surfaces use a different ID type, different
format types, and different API functions.
Also, introduce IMGFMT_VDPAU_OUTPUT for VdpOutputSurfaces wrapped in
mp_image, rather than hacking it. This is a bit cleaner.
Diffstat (limited to 'video/img_format.c')
-rw-r--r-- | video/img_format.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/video/img_format.c b/video/img_format.c index c8f1851a43..01bf2b2b87 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -42,6 +42,8 @@ struct mp_imgfmt_entry { }; static const struct mp_imgfmt_entry mp_imgfmt_list[] = { + // not in ffmpeg + FMT("vdpau_output", IMGFMT_VDPAU_OUTPUT) // these formats are pretty common, and the "le"/"be" suffixes enforced // by FFmpeg are annoying FMT("yuv420p10", IMGFMT_420P10) @@ -128,12 +130,26 @@ const char *mp_imgfmt_to_name(int fmt) return "unknown"; } +static struct mp_imgfmt_desc mp_only_imgfmt_desc(int mpfmt) +{ + switch (mpfmt) { + case IMGFMT_VDPAU_OUTPUT: + return (struct mp_imgfmt_desc) { + .id = mpfmt, + .avformat = AV_PIX_FMT_NONE, + .name = mp_imgfmt_to_name(mpfmt), + .flags = MP_IMGFLAG_BE | MP_IMGFLAG_LE | MP_IMGFLAG_RGB, + }; + } + return (struct mp_imgfmt_desc) {0}; +} + struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt) { enum AVPixelFormat fmt = imgfmt2pixfmt(mpfmt); const AVPixFmtDescriptor *pd = av_pix_fmt_desc_get(fmt); if (!pd || fmt == AV_PIX_FMT_NONE) - return (struct mp_imgfmt_desc) {0}; + return mp_only_imgfmt_desc(mpfmt); struct mp_imgfmt_desc desc = { .id = mpfmt, |