You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
Merge commit 'bef067f88c74190cdf7e76d12f02e12e069974aa'
* commit 'bef067f88c74190cdf7e76d12f02e12e069974aa': vdpau: check video surface and decoder capabilities Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -76,9 +76,13 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
|
|||||||
{
|
{
|
||||||
VDPAUHWContext *hwctx = avctx->hwaccel_context;
|
VDPAUHWContext *hwctx = avctx->hwaccel_context;
|
||||||
VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
|
VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
|
||||||
|
VdpVideoSurfaceQueryCapabilities *surface_query_caps;
|
||||||
|
VdpDecoderQueryCapabilities *decoder_query_caps;
|
||||||
VdpDecoderCreate *create;
|
VdpDecoderCreate *create;
|
||||||
void *func;
|
void *func;
|
||||||
VdpStatus status;
|
VdpStatus status;
|
||||||
|
VdpBool supported;
|
||||||
|
uint32_t max_level, max_mb, max_width, max_height;
|
||||||
/* See vdpau/vdpau.h for alignment constraints. */
|
/* See vdpau/vdpau.h for alignment constraints. */
|
||||||
uint32_t width = (avctx->coded_width + 1) & ~1;
|
uint32_t width = (avctx->coded_width + 1) & ~1;
|
||||||
uint32_t height = (avctx->coded_height + 3) & ~3;
|
uint32_t height = (avctx->coded_height + 3) & ~3;
|
||||||
@@ -103,6 +107,42 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
|
|||||||
vdctx->device = hwctx->device;
|
vdctx->device = hwctx->device;
|
||||||
vdctx->get_proc_address = hwctx->get_proc_address;
|
vdctx->get_proc_address = hwctx->get_proc_address;
|
||||||
|
|
||||||
|
if (level < 0)
|
||||||
|
return AVERROR(ENOTSUP);
|
||||||
|
|
||||||
|
status = vdctx->get_proc_address(vdctx->device,
|
||||||
|
VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
|
||||||
|
&func);
|
||||||
|
if (status != VDP_STATUS_OK)
|
||||||
|
return vdpau_error(status);
|
||||||
|
else
|
||||||
|
surface_query_caps = func;
|
||||||
|
|
||||||
|
status = surface_query_caps(vdctx->device, VDP_CHROMA_TYPE_420, &supported,
|
||||||
|
&max_width, &max_height);
|
||||||
|
if (status != VDP_STATUS_OK)
|
||||||
|
return vdpau_error(status);
|
||||||
|
if (supported != VDP_TRUE ||
|
||||||
|
max_width < width || max_height < height)
|
||||||
|
return AVERROR(ENOTSUP);
|
||||||
|
|
||||||
|
status = vdctx->get_proc_address(vdctx->device,
|
||||||
|
VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,
|
||||||
|
&func);
|
||||||
|
if (status != VDP_STATUS_OK)
|
||||||
|
return vdpau_error(status);
|
||||||
|
else
|
||||||
|
decoder_query_caps = func;
|
||||||
|
|
||||||
|
status = decoder_query_caps(vdctx->device, profile, &supported, &max_level,
|
||||||
|
&max_mb, &max_width, &max_height);
|
||||||
|
if (status != VDP_STATUS_OK)
|
||||||
|
return vdpau_error(status);
|
||||||
|
|
||||||
|
if (supported != VDP_TRUE || max_level < level ||
|
||||||
|
max_width < width || max_height < height)
|
||||||
|
return AVERROR(ENOTSUP);
|
||||||
|
|
||||||
status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE,
|
status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE,
|
||||||
&func);
|
&func);
|
||||||
if (status != VDP_STATUS_OK)
|
if (status != VDP_STATUS_OK)
|
||||||
|
Reference in New Issue
Block a user