Commit f2891fbd authored by Wenbin Chen's avatar Wenbin Chen Committed by James Almer

libavutil/hwcontext_qsv: fix a bug for mapping qsv frame to vaapi

Command below failed.
ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128
-init_hw_device qsv=qs@va -hwaccel qsv -hwaccel_device qs
-filter_hw_device va -c:v h264_qsv
-i 1080P.264 -vf "hwmap,format=vaapi" -c:v h264_vaapi output.264

Cause: Assign pair->first directly to data[3] in vaapi frame.
pair->first is *VASurfaceID while data[3] in vaapi frame is
VASurfaceID. I fix this line of code. Now the command above works.
Signed-off-by: 's avatarWenbin Chen <wenbin.chen@intel.com>
parent a46e78d5
......@@ -781,7 +781,11 @@ static int qsv_map_from(AVHWFramesContext *ctx,
case AV_HWDEVICE_TYPE_VAAPI:
{
mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId;
child_data = pair->first;
/* pair->first is *VASurfaceID while data[3] in vaapi frame is VASurfaceID, so
* we need this casting for vaapi.
* Add intptr_t to force cast from VASurfaceID(uint) type to pointer(long) type
* to avoid compile warning */
child_data = (uint8_t*)(intptr_t)*(VASurfaceID*)pair->first;
break;
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment