void CVDPAU::FFDrawSlice(struct AVCodecContext *s, const AVFrame *src, int offset[4], int y, int type, int height) { CDVDVideoCodecFFmpeg* ctx = (CDVDVideoCodecFFmpeg*)s->opaque; CVDPAU* vdp = (CVDPAU*)ctx->GetHardware(); // while we are waiting to recover we can't do anything CSharedLock lock(vdp->m_DecoderSection); { CSharedLock dLock(vdp->m_DisplaySection); if(vdp->m_DisplayState != VDPAU_OPEN) return; } if(src->linesize[0] || src->linesize[1] || src->linesize[2] || offset[0] || offset[1] || offset[2]) { CLog::Log(LOGERROR, "CVDPAU::FFDrawSlice - invalid linesizes or offsets provided"); return; } VdpStatus vdp_st; vdpau_render_state * render; render = (vdpau_render_state*)src->data[0]; if(!render) { CLog::Log(LOGERROR, "CVDPAU::FFDrawSlice - invalid context handle provided"); return; } // ffmpeg vc-1 decoder does not flush, make sure the data buffer is still valid if (!vdp->IsSurfaceValid(render)) { CLog::Log(LOGWARNING, "CVDPAU::FFDrawSlice - ignoring invalid buffer"); return; } uint32_t max_refs = 0; if(s->pix_fmt == PIX_FMT_VDPAU_H264) max_refs = render->info.h264.num_ref_frames; if(vdp->decoder == VDP_INVALID_HANDLE || vdp->vdpauConfigured == false || vdp->max_references < max_refs) { if(!vdp->ConfigVDPAU(s, max_refs)) return; } vdp_st = vdp->vdp_decoder_render(vdp->decoder, render->surface, (VdpPictureInfo const *)&(render->info), render->bitstream_buffers_used, render->bitstream_buffers); vdp->CheckStatus(vdp_st, __LINE__); }
void CVDPAU::FFDrawSlice(struct AVCodecContext *s, const AVFrame *src, int offset[4], int y, int type, int height) { CDVDVideoCodecFFmpeg* ctx = (CDVDVideoCodecFFmpeg*)s->opaque; CVDPAU* vdp = (CVDPAU*)ctx->GetHardware(); /* while we are waiting to recover we can't do anything */ if(vdp->recover) return; if(src->linesize[0] || src->linesize[1] || src->linesize[2] || offset[0] || offset[1] || offset[2]) { CLog::Log(LOGERROR, "CVDPAU::FFDrawSlice - invalid linesizes or offsets provided"); return; } VdpStatus vdp_st; vdpau_render_state * render; render = (vdpau_render_state*)src->data[0]; if(!render) { CLog::Log(LOGERROR, "CVDPAU::FFDrawSlice - invalid context handle provided"); return; } uint32_t max_refs = 0; if(s->pix_fmt == PIX_FMT_VDPAU_H264) max_refs = render->info.h264.num_ref_frames; if(vdp->decoder == VDP_INVALID_HANDLE || vdp->vdpauConfigured == false || vdp->max_references < max_refs) { if(!vdp->ConfigVDPAU(s, max_refs)) return; } vdp_st = vdp->vdp_decoder_render(vdp->decoder, render->surface, (VdpPictureInfo const *)&(render->info), render->bitstream_buffers_used, render->bitstream_buffers); vdp->CheckStatus(vdp_st, __LINE__); }