History

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.

Wenbin Chen committed 5 years ago

Commit f2891fb1 parent a46e78d1 file · +5 −1Browse files

Unified · Split

libavutil/hwcontext_qsv.c+5−1
@@ -781,7 +781,11 @@ static int qsv_map_from(AVHWFramesContext *ctx, · 780 unmodified lines
781781 case AV_HWDEVICE_TYPE_VAAPI:
782782 {
783783 mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId;
784− child_data = pair->first;
784+ /* pair->first is *VASurfaceID while data[3] in vaapi frame is VASurfaceID, so
785+ * we need this casting for vaapi.
786+ * Add intptr_t to force cast from VASurfaceID(uint) type to pointer(long) type
787+ * to avoid compile warning */
788+ child_data = (uint8_t*)(intptr_t)*(VASurfaceID*)pair->first;
785789 break;
786790 }
787791 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t