On Sat, 13 May 2017 12:09:45 +0200
Anton Khirnov <[email protected]> wrote:

> Generally looks good, though I'm not very familiar with this hwaccel.
> Are you planning to deprecate the old-style hwaccels?

I would, but that's not up to me, but to important API users like VLC
and lavfilters.

> > +    unsigned guid_count, i;
> > +    GUID decoder_guid;
> > +    DXGI_FORMAT surface_format = avctx->sw_pix_fmt == AV_PIX_FMT_YUV420P10 
> > ?
> > +                                 DXGI_FORMAT_P010 : DXGI_FORMAT_NV12;
> > +    D3D11_VIDEO_DECODER_DESC desc = { 0 };
> > +    D3D11_VIDEO_DECODER_CONFIG config;
> > +    AVHWFramesContext *frames_ctx = (AVHWFramesContext 
> > *)avctx->hw_frames_ctx->data;
> > +    AVD3D11VADeviceContext *device_hwctx = frames_ctx->device_ctx->hwctx;
> > +    AVD3D11VAFramesContext *frames_hwctx = frames_ctx->hwctx;
> > +    D3D11_TEXTURE2D_DESC texdesc;
> > +    HRESULT hr;
> > +    int ret;
> > +
> > +    if (!frames_hwctx->texture) {
> > +        av_log(avctx, AV_LOG_ERROR, "AVD3D11VAFramesContext.texture not 
> > set.\n");
> > +        return AVERROR(EINVAL);
> > +    }
> > +    ID3D11Texture2D_GetDesc(frames_hwctx->texture, &texdesc);
> > +
> > +    guid_count = 
> > ID3D11VideoDevice_GetVideoDecoderProfileCount(device_hwctx->video_device);
> > +    guid_list = av_malloc(sizeof(*guid_list) * guid_count);  
> 
> I'd expect that you need to check that guid_count is positive.

No, the API actually returns an UINT.

> > +    av_buffer_unref(&avctx->hw_frames_ctx);  
> 
> Why? This should already be done at the higher level, no?
> 

Probably. This code could be run on init failure too, at which point
reasoning about whether the generic code unrefs this correctly and soon
enough becomes hard.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to