[FFmpeg-devel] [PATCH] libavcodec/videotoolboxenc.c: Fix 3 'discards qualifiers' clang compiler warnings

Patrick Earnest patrick at patrickearnest.com
Tue Jun 6 08:05:12 EEST 2017


This email should have the patch. Sorry for the duplicate.

When compiled by clang, libavcodec/videotoolboxenc.c produces three 'discards qualifiers' warnings. 
Changing type of nums[2] from void * to CFNumberRef silences the first two warnings.
Adding a pointer (numsptr) to nums[2], and using that in CFArrayCreate silences the third warning.

Signed-off-by: Patrick Earnest <patrick at patrickearnest.com>
---
 libavcodec/videotoolboxenc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 638f278cd0..4cc4fbfef4 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -904,7 +904,8 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
     CFArrayRef   data_rate_limits;
     int64_t      bytes_per_second_value = 0;
     int64_t      one_second_value = 0;
-    void         *nums[2];
+    CFNumberRef  nums[2];
+    void         *numsptr = nums;
 
     int status = VTCompressionSessionCreate(kCFAllocatorDefault,
                                             avctx->width,
@@ -962,7 +963,7 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
     nums[0] = bytes_per_second;
     nums[1] = one_second;
     data_rate_limits = CFArrayCreate(kCFAllocatorDefault,
-                                     nums,
+                                     numsptr,
                                      2,
                                      &kCFTypeArrayCallBacks);
 
-- 
2.11.0 (Apple Git-81)



More information about the ffmpeg-devel mailing list