summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-04-29 23:28:15 +0200
committerwm4 <wm4@nowhere>2016-04-29 23:30:01 +0200
commit64f9e48bf1d67ed22f2488f7135a082a8ffbe716 (patch)
tree54af436abd781db730d18f5b5a387193f883b560
parent016eab220971ecd3d4509bb4936cb579e9b4a7c3 (diff)
downloadmpv-64f9e48bf1d67ed22f2488f7135a082a8ffbe716.tar.bz2
mpv-64f9e48bf1d67ed22f2488f7135a082a8ffbe716.tar.xz
d3d11va, dxva2: return the format struct directly
Slight simplification, IMHO.
-rw-r--r--video/decode/d3d.c10
-rw-r--r--video/decode/d3d.h3
-rw-r--r--video/decode/d3d11va.c8
-rw-r--r--video/decode/dxva2.c8
4 files changed, 13 insertions, 16 deletions
diff --git a/video/decode/d3d.c b/video/decode/d3d.c
index e55ca22073..38ff8c5e04 100644
--- a/video/decode/d3d.c
+++ b/video/decode/d3d.c
@@ -137,9 +137,8 @@ struct d3d_decoder_fmt d3d_select_decoder_mode(
const struct d3d_decoded_format *fmt))
{
struct d3d_decoder_fmt fmt = {
- .guid = &GUID_NULL,
- .mpfmt_decoded = IMGFMT_NONE,
- .dxfmt_decoded = 0,
+ .guid = &GUID_NULL,
+ .format = NULL,
};
// this has the right bit-depth, but is unfortunately not the native format
@@ -168,9 +167,8 @@ struct d3d_decoder_fmt d3d_select_decoder_mode(
MP_VERBOSE(s, "%d\n", (int)format->dxfmt);
}
- fmt.guid = mode->guid;
- fmt.mpfmt_decoded = format->mpfmt;
- fmt.dxfmt_decoded = format->dxfmt;
+ fmt.guid = mode->guid;
+ fmt.format = format;
return fmt;
}
}
diff --git a/video/decode/d3d.h b/video/decode/d3d.h
index 21b930528a..3f5b8aebe7 100644
--- a/video/decode/d3d.h
+++ b/video/decode/d3d.h
@@ -33,8 +33,7 @@ struct d3d_decoded_format {
struct d3d_decoder_fmt {
const GUID *guid;
- int mpfmt_decoded;
- DWORD dxfmt_decoded; // D3DFORMAT or DXGI_FORMAT
+ const struct d3d_decoded_format *format;
};
int d3d_probe_codec(const char *codec);
diff --git a/video/decode/d3d11va.c b/video/decode/d3d11va.c
index c792aafa01..85f48c5352 100644
--- a/video/decode/d3d11va.c
+++ b/video/decode/d3d11va.c
@@ -251,14 +251,14 @@ static int d3d11va_init_decoder(struct lavc_ctx *s, int w, int h)
d3d_select_decoder_mode(s, device_guids, n_guids,
d3d11_formats, MP_ARRAY_SIZE(d3d11_formats),
d3d11_format_supported);
- if (fmt.mpfmt_decoded == IMGFMT_NONE) {
+ if (!fmt.format) {
MP_ERR(p, "Failed to find a suitable decoder\n");
goto done;
}
struct d3d11va_decoder *decoder = talloc_zero(tmp, struct d3d11va_decoder);
talloc_set_destructor(decoder, d3d11va_destroy_decoder);
- decoder->mpfmt_decoded = fmt.mpfmt_decoded;
+ decoder->mpfmt_decoded = fmt.format->mpfmt;
int n_surfaces = hwdec_get_max_refs(s) + ADDITIONAL_SURFACES;
int w_align = w, h_align = h;
@@ -269,7 +269,7 @@ static int d3d11va_init_decoder(struct lavc_ctx *s, int w, int h)
.Width = w_align,
.Height = h_align,
.MipLevels = 1,
- .Format = fmt.dxfmt_decoded,
+ .Format = fmt.format->dxfmt,
.SampleDesc.Count = 1,
.MiscFlags = 0,
.ArraySize = n_surfaces,
@@ -336,7 +336,7 @@ static int d3d11va_init_decoder(struct lavc_ctx *s, int w, int h)
.Guid = *fmt.guid,
.SampleWidth = w,
.SampleHeight = h,
- .OutputFormat = fmt.dxfmt_decoded,
+ .OutputFormat = fmt.format->dxfmt,
};
UINT n_cfg;
hr = ID3D11VideoDevice_GetVideoDecoderConfigCount(p->video_dev,
diff --git a/video/decode/dxva2.c b/video/decode/dxva2.c
index 0fd4acafba..c851859b6b 100644
--- a/video/decode/dxva2.c
+++ b/video/decode/dxva2.c
@@ -197,12 +197,12 @@ static int dxva2_init_decoder(struct lavc_ctx *s, int w, int h)
d3d9_formats, MP_ARRAY_SIZE(d3d9_formats),
dxva2_format_supported);
CoTaskMemFree(device_guids);
- if (fmt.mpfmt_decoded == IMGFMT_NONE) {
+ if (!fmt.format) {
MP_ERR(p, "Failed to find a suitable decoder\n");
goto done;
}
- p->mpfmt_decoded = fmt.mpfmt_decoded;
+ p->mpfmt_decoded = fmt.format->mpfmt;
struct mp_image_pool *decoder_pool =
talloc_steal(tmp, mp_image_pool_new(n_surfaces));
DXVA2_ConfigPictureDecode *decoder_config =
@@ -213,7 +213,7 @@ static int dxva2_init_decoder(struct lavc_ctx *s, int w, int h)
DXVA2_VideoDesc video_desc ={
.SampleWidth = w,
.SampleHeight = h,
- .Format = fmt.dxfmt_decoded,
+ .Format = fmt.format->dxfmt,
};
UINT n_configs = 0;
DXVA2_ConfigPictureDecode *configs = NULL;
@@ -246,7 +246,7 @@ static int dxva2_init_decoder(struct lavc_ctx *s, int w, int h)
hr = IDirectXVideoDecoderService_CreateSurface(
p->decoder_service,
w_align, h_align,
- n_surfaces - 1, fmt.dxfmt_decoded, D3DPOOL_DEFAULT, 0,
+ n_surfaces - 1, fmt.format->dxfmt, D3DPOOL_DEFAULT, 0,
DXVA2_VideoDecoderRenderTarget, surfaces, NULL);
if (FAILED(hr)) {
MP_ERR(p, "Failed to create %d video surfaces: %s\n",