#23 Fix build with gcc14 (-Wint-conversion, -Wincompatible-pointer-types)
Merged 4 months ago by rathann. Opened 4 months ago by smani.
rpms/ smani/ffmpeg rawhide  into  rawhide

file added
+131
@@ -0,0 +1,131 @@ 

+ From 68ef9a29478fad450ec29ec14120afad3938e75b Mon Sep 17 00:00:00 2001

+ From: Sandro Mani <manisandro@gmail.com>

+ Date: Tue, 30 Jan 2024 09:16:13 +0100

+ Subject: [PATCH] Fix -Wint-conversion and -Wincompatible-pointer-types errors

+ 

+ ---

+  libavcodec/pcm-bluray.c           | 4 ++--

+  libavcodec/pcm-dvd.c              | 2 +-

+  libavcodec/vulkan_av1.c           | 2 +-

+  libavcodec/vulkan_decode.c        | 6 +++---

+  libavcodec/vulkan_video.c         | 2 +-

+  libavfilter/vsrc_testsrc_vulkan.c | 4 ++--

+  libavutil/hwcontext_vaapi.c       | 2 +-

+  7 files changed, 11 insertions(+), 11 deletions(-)

+ 

+ diff --git a/libavcodec/pcm-bluray.c b/libavcodec/pcm-bluray.c

+ index f656095..56fa373 100644

+ --- a/libavcodec/pcm-bluray.c

+ +++ b/libavcodec/pcm-bluray.c

+ @@ -167,7 +167,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame,

+              samples *= num_source_channels;

+              if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {

+  #if HAVE_BIGENDIAN

+ -                bytestream2_get_buffer(&gb, dst16, buf_size);

+ +                bytestream2_get_buffer(&gb, (uint8_t*)dst16, buf_size);

+  #else

+                  do {

+                      *dst16++ = bytestream2_get_be16u(&gb);

+ @@ -187,7 +187,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame,

+              if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {

+                  do {

+  #if HAVE_BIGENDIAN

+ -                    bytestream2_get_buffer(&gb, dst16, avctx->ch_layout.nb_channels * 2);

+ +                    bytestream2_get_buffer(&gb, (uint8_t*)dst16, avctx->ch_layout.nb_channels * 2);

+                      dst16 += avctx->ch_layout.nb_channels;

+  #else

+                      channel = avctx->ch_layout.nb_channels;

+ diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c

+ index 419b2a1..319746c 100644

+ --- a/libavcodec/pcm-dvd.c

+ +++ b/libavcodec/pcm-dvd.c

+ @@ -157,7 +157,7 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src,

+      switch (avctx->bits_per_coded_sample) {

+      case 16: {

+  #if HAVE_BIGENDIAN

+ -        bytestream2_get_buffer(&gb, dst16, blocks * s->block_size);

+ +        bytestream2_get_buffer(&gb, (uint8_t*)dst16, blocks * s->block_size);

+          dst16 += blocks * s->block_size / 2;

+  #else

+          int samples = blocks * avctx->ch_layout.nb_channels;

+ diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c

+ index 4998bf7..9730e4b 100644

+ --- a/libavcodec/vulkan_av1.c

+ +++ b/libavcodec/vulkan_av1.c

+ @@ -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);

+ diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c

+ index a89d84f..fdbcbb4 100644

+ --- a/libavcodec/vulkan_decode.c

+ +++ b/libavcodec/vulkan_decode.c

+ @@ -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;

+ diff --git a/libavcodec/vulkan_video.c b/libavcodec/vulkan_video.c

+ index 236aa12..c5144bd 100644

+ --- a/libavcodec/vulkan_video.c

+ +++ b/libavcodec/vulkan_video.c

+ @@ -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)

+ diff --git a/libavfilter/vsrc_testsrc_vulkan.c b/libavfilter/vsrc_testsrc_vulkan.c

+ index 8761c21..1720bfa 100644

+ --- a/libavfilter/vsrc_testsrc_vulkan.c

+ +++ b/libavfilter/vsrc_testsrc_vulkan.c

+ @@ -231,7 +231,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx)

+                  return AVERROR(ENOMEM);

+  

+              err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, s->picref, NULL,

+ -                                              NULL, &s->opts, sizeof(s->opts));

+ +                                              VK_NULL_HANDLE, &s->opts, sizeof(s->opts));

+              if (err < 0)

+                  return err;

+          }

+ @@ -250,7 +250,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx)

+      frame->sample_aspect_ratio = s->sar;

+      if (!s->draw_once) {

+          err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, frame, NULL,

+ -                                          NULL, &s->opts, sizeof(s->opts));

+ +                                          VK_NULL_HANDLE, &s->opts, sizeof(s->opts));

+          if (err < 0) {

+              av_frame_free(&frame);

+              return err;

+ diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c

+ index 12bc951..d326ad6 100644

+ --- a/libavutil/hwcontext_vaapi.c

+ +++ b/libavutil/hwcontext_vaapi.c

+ @@ -1203,7 +1203,7 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst,

+  

+      if (!use_prime2 || vas != VA_STATUS_SUCCESS) {

+          int k;

+ -        unsigned long buffer_handle;

+ +        size_t buffer_handle;

+          VASurfaceAttribExternalBuffers buffer_desc;

+          VASurfaceAttrib buffer_attrs[2] = {

+              {

+ -- 

+ 2.43.0

+ 

file modified
+2
@@ -120,6 +120,8 @@ 

  # https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10211

  Patch4:         0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch

  Patch5:         ffmpeg-c99.patch

+ # Fix build with gcc14 (-Wint-conversion, -Wincompatible-pointer-types)

+ Patch6:         ffmpeg-gcc14.patch

  

  # Set up dlopen for openh264

  Patch1001:      ffmpeg-dlopen-openh264.patch

no initial comment

LGTM.
The vulkan part is fixed upstream already:
https://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=2f24f10d9cf34ddce274496c4daa73f732d370c1

Could you submit the remaining parts upstream?

I've sent the patch to ffmpeg-devel. Any objections to merging this in the meantime and building to f40-build-side-82395 to unblock [1]?

[1] https://bodhi.fedoraproject.org/updates/FEDORA-2024-c9c74ec34d

Can you please add a comment with a link to the email of the patch?

Sorry, I've reported the issue upstream and tought the fix was complete.
https://trac.ffmpeg.org/ticket/10833#comment:3

I've pushed without seen this PR
Please revert/rebase as appropriate

rebased onto 774d42a

4 months ago

Reverted and rebased. @smani you can merge and build once you've added the link to the e-mail as comment.

I don't know why but even after one day my mail isn't appearing on https://ffmpeg.org//pipermail/ffmpeg-devel/2024-January/thread.html (I subscribed to the list)

Pull-Request has been merged by rathann

4 months ago

Merged and building in f40-build-side-82395 . The upstream e-mail link can be added later.

Metadata