Skip to content

Commit

Permalink
libavcodec: fix -Wint-conversion in vulkan
Browse files Browse the repository at this point in the history
FIx warnings (soon to be errors in GCC 14, already so in Clang 15):
```
src/libavcodec/vulkan_av1.c: In function ‘vk_av1_create_params’:
src/libavcodec/vulkan_av1.c:183:43: error: initialization of ‘long long unsigned int’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
  183 |         .videoSessionParametersTemplate = NULL,
      |                                           ^~~~
src/libavcodec/vulkan_av1.c:183:43: note: (near initialization for ‘(anonymous).videoSessionParametersTemplate’)
```

Use Vulkan's VK_NULL_HANDLE instead of bare NULL.

Fix Trac ticket #10724.

Was reported downstream in Gentoo at https://bugs.gentoo.org/919067.

Signed-off-by: Sam James <sam@gentoo.org>
  • Loading branch information
thesamesam authored and cyanreg committed Jan 6, 2024
1 parent 9109273 commit 2f24f10
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libavcodec/vulkan_av1.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf)
.sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
.pNext = &av1_params,
.videoSession = ctx->common.session,
.videoSessionParametersTemplate = NULL,
.videoSessionParametersTemplate = VK_NULL_HANDLE,
};

err = ff_vk_decode_create_params(buf, avctx, ctx, &session_params_create);
Expand Down
6 changes: 3 additions & 3 deletions libavcodec/vulkan_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ int ff_vk_decode_prepare_frame(FFVulkanDecodeContext *dec, AVFrame *pic,
return 0;

vkpic->dpb_frame = NULL;
vkpic->img_view_ref = NULL;
vkpic->img_view_out = NULL;
vkpic->img_view_dest = NULL;
vkpic->img_view_ref = VK_NULL_HANDLE;
vkpic->img_view_out = VK_NULL_HANDLE;
vkpic->img_view_dest = VK_NULL_HANDLE;

vkpic->destroy_image_view = vk->DestroyImageView;
vkpic->wait_semaphores = vk->WaitSemaphores;
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/vulkan_h264.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static int vk_h264_create_params(AVCodecContext *avctx, AVBufferRef **buf)
.sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
.pNext = &h264_params,
.videoSession = ctx->common.session,
.videoSessionParametersTemplate = NULL,
.videoSessionParametersTemplate = VK_NULL_HANDLE,
};

/* SPS list */
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/vulkan_hevc.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf)
.sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
.pNext = &h265_params,
.videoSession = ctx->common.session,
.videoSessionParametersTemplate = NULL,
.videoSessionParametersTemplate = VK_NULL_HANDLE,
};

HEVCHeaderSet *hdr;
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/vulkan_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ av_cold void ff_vk_video_common_uninit(FFVulkanContext *s,
if (common->session) {
vk->DestroyVideoSessionKHR(s->hwctx->act_dev, common->session,
s->hwctx->alloc);
common->session = NULL;
common->session = VK_NULL_HANDLE;
}

if (common->nb_mem && common->mem)
Expand Down

0 comments on commit 2f24f10

Please sign in to comment.