// hwaccel_context bool VideoDecoderDXVAPrivate::setup(void **hwctx, AVPixelFormat *chroma, int w, int h) { if (w <= 0 || h <= 0) return false; if (!decoder || ((width != w || height != h) && (surface_width != FFALIGN(w, 16) || surface_height != FFALIGN(h, 16))//) )) { DxDestroyVideoConversion(); DxDestroyVideoDecoder(); *hwctx = NULL; *chroma = QTAV_PIX_FMT_C(NONE); /* FIXME transmit a video_format_t by VaSetup directly */ if (!DxCreateVideoDecoder(codec_ctx->codec_id, w, h)) return false; hw.decoder = decoder; hw.cfg = &cfg; hw.surface_count = surface_count; hw.surface = hw_surfaces; memset(hw_surfaces, 0, sizeof(hw_surfaces)); for (unsigned i = 0; i < surface_count; i++) hw.surface[i] = surfaces[i].d3d; DxCreateVideoConversion(); } *hwctx = &hw; const d3d_format_t *outfmt = D3dFindFormat(output); *chroma = outfmt ? outfmt->codec : QTAV_PIX_FMT_C(NONE); return true; }
// hwaccel_context bool VideoDecoderDXVAPrivate::setup(AVCodecContext *avctx) { const int w = codedWidth(avctx); const int h = codedHeight(avctx); if (decoder && surface_width == aligned(w) && surface_height == aligned(h)) { avctx->hwaccel_context = &hw_ctx; return true; } width = avctx->width; // not necessary. set in decode() height = avctx->height; releaseUSWC(); DxDestroyVideoDecoder(); avctx->hwaccel_context = NULL; /* FIXME transmit a video_format_t by VaSetup directly */ if (!DxCreateVideoDecoder(avctx->codec_id, w, h)) return false; avctx->hwaccel_context = &hw_ctx; hw_ctx.decoder = decoder; hw_ctx.cfg = &cfg; hw_ctx.surface_count = surface_count; hw_ctx.surface = hw_surfaces; memset(hw_surfaces, 0, sizeof(hw_surfaces)); for (unsigned i = 0; i < surface_count; i++) hw_ctx.surface[i] = surfaces[i].d3d; initUSWC(surface_width); return true; }
static int Setup(vlc_va_t *external, void **hw, vlc_fourcc_t *chroma, int width, int height) { vlc_va_dxva2_t *va = vlc_va_dxva2_Get(external); if (va->width == width && va->height == height && va->decoder) goto ok; /* */ DxDestroyVideoConversion(va); DxDestroyVideoDecoder(va); *hw = NULL; *chroma = 0; if (width <= 0 || height <= 0) return VLC_EGENERIC; /* FIXME transmit a video_format_t by VaSetup directly */ video_format_t fmt; memset(&fmt, 0, sizeof(fmt)); fmt.i_width = width; fmt.i_height = height; if (DxCreateVideoDecoder(va, va->codec_id, &fmt)) return VLC_EGENERIC; /* */ va->hw.decoder = va->decoder; va->hw.cfg = &va->cfg; va->hw.surface_count = va->surface_count; va->hw.surface = va->hw_surface; for (unsigned i = 0; i < va->surface_count; i++) va->hw.surface[i] = va->surface[i].d3d; /* */ DxCreateVideoConversion(va); /* */ ok: *hw = &va->hw; const d3d_format_t *output = D3dFindFormat(va->output); *chroma = output->codec; return VLC_SUCCESS; }
static int Setup(vlc_va_t *va, void **hw, vlc_fourcc_t *chroma, int width, int height) { vlc_va_sys_t *sys = va->sys; if (sys->width == width && sys->height == height && sys->decoder) goto ok; /* */ DxDestroyVideoConversion(sys); DxDestroyVideoDecoder(sys); *hw = NULL; *chroma = 0; if (width <= 0 || height <= 0) return VLC_EGENERIC; /* FIXME transmit a video_format_t by VaSetup directly */ video_format_t fmt; memset(&fmt, 0, sizeof(fmt)); fmt.i_width = width; fmt.i_height = height; if (DxCreateVideoDecoder(va, sys->codec_id, &fmt)) return VLC_EGENERIC; /* */ sys->hw.decoder = sys->decoder; sys->hw.cfg = &sys->cfg; sys->hw.surface_count = sys->surface_count; sys->hw.surface = sys->hw_surface; /* */ DxCreateVideoConversion(sys); /* */ ok: *hw = &sys->hw; const d3d_format_t *output = D3dFindFormat(sys->output); *chroma = output->codec; return VLC_SUCCESS; }
// hwaccel_context bool VideoDecoderDXVAPrivate::setup(AVCodecContext *avctx) { const int w = codedWidth(avctx); const int h = codedHeight(avctx); if (decoder && surface_width == aligned(w) && surface_height == aligned(h)) { avctx->hwaccel_context = &hw_ctx; return true; } width = avctx->width; // not necessary. set in decode() height = avctx->height; releaseUSWC(); DxDestroyVideoDecoder(); avctx->hwaccel_context = NULL; /* FIXME transmit a video_format_t by VaSetup directly */ if (!DxCreateVideoDecoder(avctx->codec_id, w, h)) return false; avctx->hwaccel_context = &hw_ctx; // TODO: FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG if (IsEqualGUID(input, DXVA_Intel_H264_NoFGT_ClearVideo)) { #ifdef FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO //2014-03-07 - 8b2a130 - lavc 55.50.0 / 55.53.100 - dxva2.h qDebug("FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO"); hw_ctx.workaround |= FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO; #endif } else { hw_ctx.workaround = 0; } hw_ctx.decoder = decoder; hw_ctx.cfg = &cfg; hw_ctx.surface_count = surface_count; hw_ctx.surface = hw_surfaces; memset(hw_surfaces, 0, sizeof(hw_surfaces)); for (unsigned i = 0; i < surface_count; i++) hw_ctx.surface[i] = surfaces[i].d3d; initUSWC(surface_width); return true; }