Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code
@ 2024-07-12 15:44 Marvin Scholz
  2024-07-12 15:47 ` [FFmpeg-devel] [PATCH 02/11] avfilter/af_channelsplit: " Marvin Scholz
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 15:44 UTC (permalink / raw)
  To: ffmpeg-devel

Fix a bunch of "mixing declarations and code is incompatible with
standards before C99" warnings.
---
 libavdevice/audiotoolbox.m | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavdevice/audiotoolbox.m b/libavdevice/audiotoolbox.m
index 7d95c34593..dd607589b4 100644
--- a/libavdevice/audiotoolbox.m
+++ b/libavdevice/audiotoolbox.m
@@ -77,6 +77,9 @@ static av_cold int at_write_header(AVFormatContext *avctx)
     ATContext *ctx = (ATContext*)avctx->priv_data;
     OSStatus err = noErr;
     CFStringRef device_UID = NULL;
+    const char *stream_name = avctx->url;
+    AVCodecParameters *codecpar = avctx->streams[0]->codecpar;
+    AudioStreamBasicDescription device_format = {0};
     AudioDeviceID *devices;
     int num_devices;
 
@@ -133,7 +136,6 @@ static av_cold int at_write_header(AVFormatContext *avctx)
 
     // get user-defined device UID or use default device
     // -audio_device_index overrides any URL given
-    const char *stream_name = avctx->url;
     if (stream_name && ctx->audio_device_index == -1) {
         sscanf(stream_name, "%d", &ctx->audio_device_index);
     }
@@ -163,10 +165,8 @@ static av_cold int at_write_header(AVFormatContext *avctx)
     }
 
     av_freep(&devices);
-    AVCodecParameters *codecpar = avctx->streams[0]->codecpar;
 
     // audio format
-    AudioStreamBasicDescription device_format = {0};
     device_format.mSampleRate        = codecpar->sample_rate;
     device_format.mFormatID          = kAudioFormatLinearPCM;
     device_format.mFormatFlags      |= (codecpar->format == AV_SAMPLE_FMT_FLT) ? kLinearPCMFormatFlagIsFloat : 0;
@@ -237,6 +237,7 @@ static av_cold int at_write_header(AVFormatContext *avctx)
 
 static int at_write_packet(AVFormatContext *avctx, AVPacket *pkt)
 {
+    AudioQueueBufferRef buf;
     ATContext *ctx = (ATContext*)avctx->priv_data;
     OSStatus err = noErr;
 
@@ -256,7 +257,7 @@ static int at_write_packet(AVFormatContext *avctx, AVPacket *pkt)
         }
     }
 
-    AudioQueueBufferRef buf = ctx->buffer[ctx->cur_buf];
+    buf = ctx->buffer[ctx->cur_buf];
 
     // copy audio data into buffer and enqueue the buffer
     memcpy(buf->mAudioData, pkt->data, buf->mAudioDataBytesCapacity);

base-commit: 85706f5136cf7c88f95843b2634dd3f7d7d2cb6d
-- 
2.39.3 (Apple Git-146)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [FFmpeg-devel] [PATCH 02/11] avfilter/af_channelsplit: fix mixed declaration and code
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
@ 2024-07-12 15:47 ` Marvin Scholz
  2024-07-14 17:39   ` Leo Izen
  2024-07-12 16:07 ` [FFmpeg-devel] [PATCH 03/11] avdevice/avfoundation: fix mixed declarations " Marvin Scholz
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 15:47 UTC (permalink / raw)
  To: ffmpeg-devel

Fix a "mixing declarations and code is incompatible with standards
before C99" warning.
---
 libavfilter/af_channelsplit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c
index 43b2667750..b91195a4c6 100644
--- a/libavfilter/af_channelsplit.c
+++ b/libavfilter/af_channelsplit.c
@@ -151,6 +151,7 @@ static int query_formats(AVFilterContext *ctx)
 
 static int filter_frame(AVFilterLink *outlink, AVFrame *buf)
 {
+    AVFrame *buf_out;
     AVFilterContext *ctx = outlink->src;
     ChannelSplitContext *s = ctx->priv;
     const int i = FF_OUTLINK_IDX(outlink);
@@ -159,7 +160,7 @@ static int filter_frame(AVFilterLink *outlink, AVFrame *buf)
 
     av_assert1(channel >= 0);
 
-    AVFrame *buf_out = av_frame_clone(buf);
+    buf_out = av_frame_clone(buf);
     if (!buf_out)
         return AVERROR(ENOMEM);
 
-- 
2.39.3 (Apple Git-146)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [FFmpeg-devel] [PATCH 03/11] avdevice/avfoundation: fix mixed declarations and code
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
  2024-07-12 15:47 ` [FFmpeg-devel] [PATCH 02/11] avfilter/af_channelsplit: " Marvin Scholz
@ 2024-07-12 16:07 ` Marvin Scholz
  2024-07-12 16:09 ` [FFmpeg-devel] [PATCH 04/11] avdevice/avfoundation: remove write-only variable Marvin Scholz
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 16:07 UTC (permalink / raw)
  To: ffmpeg-devel

Fix several "mixing declarations and code is incompatible with standards
before C99" warnings.
---
 libavdevice/avfoundation.m | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index c5a09c6563..17900d39d9 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -680,6 +680,7 @@ static int get_audio_config(AVFormatContext *s)
 {
     AVFContext *ctx = (AVFContext*)s->priv_data;
     CMFormatDescriptionRef format_desc;
+    const AudioStreamBasicDescription *basic_desc;
     AVStream* stream = avformat_new_stream(s, NULL);
 
     if (!stream) {
@@ -698,7 +699,7 @@ static int get_audio_config(AVFormatContext *s)
     avpriv_set_pts_info(stream, 64, 1, avf_time_base);
 
     format_desc = CMSampleBufferGetFormatDescription(ctx->current_audio_frame);
-    const AudioStreamBasicDescription *basic_desc = CMAudioFormatDescriptionGetStreamBasicDescription(format_desc);
+    basic_desc = CMAudioFormatDescriptionGetStreamBasicDescription(format_desc);
 
     if (!basic_desc) {
         unlock_frames(ctx);
@@ -765,7 +766,9 @@ static int get_audio_config(AVFormatContext *s)
 
 static NSArray* getDevicesWithMediaType(AVMediaType mediaType) {
 #if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500))
+    AVCaptureDeviceDiscoverySession *captureDeviceDiscoverySession;
     NSMutableArray *deviceTypes = nil;
+
     if (mediaType == AVMediaTypeVideo) {
         deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]];
         #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000)
@@ -810,7 +813,7 @@ static int get_audio_config(AVFormatContext *s)
         return nil;
     }
 
-    AVCaptureDeviceDiscoverySession *captureDeviceDiscoverySession =
+    captureDeviceDiscoverySession =
         [AVCaptureDeviceDiscoverySession
         discoverySessionWithDeviceTypes:deviceTypes
                               mediaType:mediaType
@@ -899,8 +902,9 @@ static int avf_read_header(AVFormatContext *s)
         } else if (ctx->video_device_index < ctx->num_video_devices + num_screens) {
 #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
             CGDirectDisplayID screens[num_screens];
+            AVCaptureScreenInput* capture_screen_input;
             CGGetActiveDisplayList(num_screens, screens, &num_screens);
-            AVCaptureScreenInput* capture_screen_input = [[[AVCaptureScreenInput alloc] initWithDisplayID:screens[ctx->video_device_index - ctx->num_video_devices]] autorelease];
+            capture_screen_input = [[[AVCaptureScreenInput alloc] initWithDisplayID:screens[ctx->video_device_index - ctx->num_video_devices]] autorelease];
 
             if (ctx->framerate.num > 0) {
                 capture_screen_input.minFrameDuration = CMTimeMake(ctx->framerate.den, ctx->framerate.num);
@@ -954,8 +958,9 @@ static int avf_read_header(AVFormatContext *s)
             int idx;
             if(sscanf(ctx->video_filename, "Capture screen %d", &idx) && idx < num_screens) {
                 CGDirectDisplayID screens[num_screens];
+                AVCaptureScreenInput* capture_screen_input;
                 CGGetActiveDisplayList(num_screens, screens, &num_screens);
-                AVCaptureScreenInput* capture_screen_input = [[[AVCaptureScreenInput alloc] initWithDisplayID:screens[idx]] autorelease];
+                capture_screen_input = [[[AVCaptureScreenInput alloc] initWithDisplayID:screens[idx]] autorelease];
                 video_device = (AVCaptureDevice*) capture_screen_input;
                 ctx->video_device_index = ctx->num_video_devices + idx;
                 ctx->video_is_screen = 1;
@@ -1123,10 +1128,12 @@ static int avf_read_packet(AVFormatContext *s, AVPacket *pkt)
     do {
         CVImageBufferRef image_buffer;
         CMBlockBufferRef block_buffer;
+        CMItemCount count;
+        CMSampleTimingInfo timing_info;
         lock_frames(ctx);
 
         if (ctx->current_frame != nil) {
-            int status;
+            int status = 0;
             int length = 0;
 
             image_buffer = CMSampleBufferGetImageBuffer(ctx->current_frame);
@@ -1146,9 +1153,6 @@ static int avf_read_packet(AVFormatContext *s, AVPacket *pkt)
                 return AVERROR(EIO);
             }
 
-            CMItemCount count;
-            CMSampleTimingInfo timing_info;
-
             if (CMSampleBufferGetOutputSampleTimingInfoArray(ctx->current_frame, 1, &timing_info, &count) == noErr) {
                 AVRational timebase_q = av_make_q(1, timing_info.presentationTimeStamp.timescale);
                 pkt->pts = pkt->dts = av_rescale_q(timing_info.presentationTimeStamp.value, timebase_q, avf_time_base_q);
@@ -1160,7 +1164,6 @@ static int avf_read_packet(AVFormatContext *s, AVPacket *pkt)
             if (image_buffer) {
                 status = copy_cvpixelbuffer(s, image_buffer, pkt);
             } else {
-                status = 0;
                 OSStatus ret = CMBlockBufferCopyDataBytes(block_buffer, 0, pkt->size, pkt->data);
                 if (ret != kCMBlockBufferNoErr) {
                     status = AVERROR(EIO);
@@ -1174,6 +1177,8 @@ static int avf_read_packet(AVFormatContext *s, AVPacket *pkt)
                 return status;
             }
         } else if (ctx->current_audio_frame != nil) {
+            CMItemCount count;
+            CMSampleTimingInfo timing_info;
             CMBlockBufferRef block_buffer = CMSampleBufferGetDataBuffer(ctx->current_audio_frame);
             int block_buffer_size         = CMBlockBufferGetDataLength(block_buffer);
 
@@ -1192,9 +1197,6 @@ static int avf_read_packet(AVFormatContext *s, AVPacket *pkt)
                 return AVERROR(EIO);
             }
 
-            CMItemCount count;
-            CMSampleTimingInfo timing_info;
-
             if (CMSampleBufferGetOutputSampleTimingInfoArray(ctx->current_audio_frame, 1, &timing_info, &count) == noErr) {
                 AVRational timebase_q = av_make_q(1, timing_info.presentationTimeStamp.timescale);
                 pkt->pts = pkt->dts = av_rescale_q(timing_info.presentationTimeStamp.value, timebase_q, avf_time_base_q);
-- 
2.39.3 (Apple Git-146)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [FFmpeg-devel] [PATCH 04/11] avdevice/avfoundation: remove write-only variable
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
  2024-07-12 15:47 ` [FFmpeg-devel] [PATCH 02/11] avfilter/af_channelsplit: " Marvin Scholz
  2024-07-12 16:07 ` [FFmpeg-devel] [PATCH 03/11] avdevice/avfoundation: fix mixed declarations " Marvin Scholz
@ 2024-07-12 16:09 ` Marvin Scholz
  2024-07-12 16:17 ` [FFmpeg-devel] [PATCH 05/11] lavfi/metal: fix mixed declaration and code Marvin Scholz
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 16:09 UTC (permalink / raw)
  To: ffmpeg-devel

The block_buffer was only ever written to but then never used in the
following code, making it unnecessary.

Fixes a "variable 'block_buffer' set but not used" compiler warning.
---
 libavdevice/avfoundation.m | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 17900d39d9..72a7f24b7d 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -632,7 +632,6 @@ static int get_video_config(AVFormatContext *s)
 {
     AVFContext *ctx = (AVFContext*)s->priv_data;
     CVImageBufferRef image_buffer;
-    CMBlockBufferRef block_buffer;
     CGSize image_buffer_size;
     AVStream* stream = avformat_new_stream(s, NULL);
 
@@ -652,7 +651,6 @@ static int get_video_config(AVFormatContext *s)
     avpriv_set_pts_info(stream, 64, 1, avf_time_base);
 
     image_buffer = CMSampleBufferGetImageBuffer(ctx->current_frame);
-    block_buffer = CMSampleBufferGetDataBuffer(ctx->current_frame);
 
     if (image_buffer) {
         image_buffer_size = CVImageBufferGetEncodedSize(image_buffer);
-- 
2.39.3 (Apple Git-146)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [FFmpeg-devel] [PATCH 05/11] lavfi/metal: fix mixed declaration and code
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
                   ` (2 preceding siblings ...)
  2024-07-12 16:09 ` [FFmpeg-devel] [PATCH 04/11] avdevice/avfoundation: remove write-only variable Marvin Scholz
@ 2024-07-12 16:17 ` Marvin Scholz
  2024-07-12 16:21 ` [FFmpeg-devel] [PATCH 06/11] lavfi/metal: simplify fallback Marvin Scholz
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 16:17 UTC (permalink / raw)
  To: ffmpeg-devel

Fix a "mixing declarations and code is incompatible with standards
before C99" warning.
---
 libavfilter/metal/utils.m | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavfilter/metal/utils.m b/libavfilter/metal/utils.m
index f365d3ceea..d5c85e619d 100644
--- a/libavfilter/metal/utils.m
+++ b/libavfilter/metal/utils.m
@@ -24,11 +24,15 @@ void ff_metal_compute_encoder_dispatch(id<MTLDevice> device,
                                        id<MTLComputeCommandEncoder> encoder,
                                        NSUInteger width, NSUInteger height)
 {
-    [encoder setComputePipelineState:pipeline];
-    NSUInteger w = pipeline.threadExecutionWidth;
-    NSUInteger h = pipeline.maxTotalThreadsPerThreadgroup / w;
-    MTLSize threadsPerThreadgroup = MTLSizeMake(w, h, 1);
     BOOL fallback = YES;
+    MTLSize threadsPerThreadgroup;
+    NSUInteger w, h;
+
+    [encoder setComputePipelineState:pipeline];
+    w = pipeline.threadExecutionWidth;
+    h = pipeline.maxTotalThreadsPerThreadgroup / w;
+    threadsPerThreadgroup = MTLSizeMake(w, h, 1);
+
     // MAC_OS_X_VERSION_10_15 is only defined on SDKs new enough to include its functionality (including iOS, tvOS, etc)
 #ifdef MAC_OS_X_VERSION_10_15
     if (@available(macOS 10.15, iOS 11, tvOS 14.5, *)) {
-- 
2.39.3 (Apple Git-146)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [FFmpeg-devel] [PATCH 06/11] lavfi/metal: simplify fallback
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
                   ` (3 preceding siblings ...)
  2024-07-12 16:17 ` [FFmpeg-devel] [PATCH 05/11] lavfi/metal: fix mixed declaration and code Marvin Scholz
@ 2024-07-12 16:21 ` Marvin Scholz
  2024-07-12 17:13 ` [FFmpeg-devel] [PATCH 07/11] avfilter/vf_coreimage: fix mixed declaration and code Marvin Scholz
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 16:21 UTC (permalink / raw)
  To: ffmpeg-devel

Instead of using a fallback variable, just do an early return.
---
 libavfilter/metal/utils.m | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavfilter/metal/utils.m b/libavfilter/metal/utils.m
index d5c85e619d..6a9e5ef7cf 100644
--- a/libavfilter/metal/utils.m
+++ b/libavfilter/metal/utils.m
@@ -24,7 +24,6 @@ void ff_metal_compute_encoder_dispatch(id<MTLDevice> device,
                                        id<MTLComputeCommandEncoder> encoder,
                                        NSUInteger width, NSUInteger height)
 {
-    BOOL fallback = YES;
     MTLSize threadsPerThreadgroup;
     NSUInteger w, h;
 
@@ -39,11 +38,13 @@ void ff_metal_compute_encoder_dispatch(id<MTLDevice> device,
         if ([device supportsFamily:MTLGPUFamilyCommon3]) {
             MTLSize threadsPerGrid = MTLSizeMake(width, height, 1);
             [encoder dispatchThreads:threadsPerGrid threadsPerThreadgroup:threadsPerThreadgroup];
-            fallback = NO;
+            return;
         }
     }
 #endif
-    if (fallback) {
+
+    // Fallback path, if we took the above one we already returned so none of this is reached
+    {
         MTLSize threadgroups = MTLSizeMake((width + w - 1) / w,
                                            (height + h - 1) / h,
                                            1);
-- 
2.39.3 (Apple Git-146)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [FFmpeg-devel] [PATCH 07/11] avfilter/vf_coreimage: fix mixed declaration and code
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
                   ` (4 preceding siblings ...)
  2024-07-12 16:21 ` [FFmpeg-devel] [PATCH 06/11] lavfi/metal: simplify fallback Marvin Scholz
@ 2024-07-12 17:13 ` Marvin Scholz
  2024-07-12 17:19 ` [FFmpeg-devel] [PATCH 08/11] avfilter/vf_coreimage: simplify list_filters code Marvin Scholz
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 17:13 UTC (permalink / raw)
  To: ffmpeg-devel

Fix several "mixing declarations and code is incompatible with
standards before C99" warnings.
---
 libavfilter/vf_coreimage.m | 60 ++++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 31 deletions(-)

diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index 4d4cdfb7c7..bfc17764b5 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -66,6 +66,7 @@
 static int config_output(AVFilterLink *link)
 {
     CoreImageContext *ctx = link->src->priv;
+    const AVPixFmtDescriptor *desc;
 
     link->w                   = ctx->w;
     link->h                   = ctx->h;
@@ -73,7 +74,7 @@ static int config_output(AVFilterLink *link)
     link->frame_rate          = ctx->frame_rate;
     link->time_base           = ctx->time_base;
 
-    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
+    desc                           = av_pix_fmt_desc_get(link->format);
     ctx->bits_per_component        = av_get_bits_per_pixel(desc) / desc->nb_components;
 
     return 0;
@@ -106,14 +107,13 @@ static void list_filters(CoreImageContext *ctx)
 
     NSString *filter_name;
     while (filter_name = [filters nextObject]) {
-        av_log(ctx, AV_LOG_INFO, "Filter: %s\n", [filter_name UTF8String]);
-        NSString *input;
-
         CIFilter *filter             = [CIFilter filterWithName:filter_name];
         NSDictionary *filter_attribs = [filter attributes]; // <nsstring, id>
         NSArray      *filter_inputs  = [filter inputKeys];  // <nsstring>
 
-        for (input in filter_inputs) {
+        av_log(ctx, AV_LOG_INFO, "Filter: %s\n", [filter_name UTF8String]);
+
+        for (NSString *input in filter_inputs) {
             NSDictionary *input_attribs = [filter_attribs valueForKey:input];
             NSString *input_class       = [input_attribs valueForKey:kCIAttributeClass];
             if ([input_class isEqualToString:@"NSNumber"]) {
@@ -139,6 +139,11 @@ static void list_filters(CoreImageContext *ctx)
 static int apply_filter(CoreImageContext *ctx, AVFilterLink *link, AVFrame *frame)
 {
     int i;
+    CGImageRef out;
+    CGRect out_rect;
+    CIFilter *filter        = NULL;
+    CIImage  *filter_input  = (__bridge CIImage*)ctx->input_image;
+    CIImage  *filter_output = NULL;
 
     // (re-)initialize input image
     const CGSize frame_size = {
@@ -150,26 +155,22 @@ static int apply_filter(CoreImageContext *ctx, AVFilterLink *link, AVFrame *fram
                            length:frame->height*frame->linesize[0]
                            freeWhenDone:NO];
 
-    CIImage *ret = [(__bridge CIImage*)ctx->input_image initWithBitmapData:data
-                                                        bytesPerRow:frame->linesize[0]
-                                                        size:frame_size
-                                                        format:kCIFormatARGB8
-                                                        colorSpace:ctx->color_space]; //kCGColorSpaceGenericRGB
+    CIImage *ret = [filter_input initWithBitmapData:data
+                                 bytesPerRow:frame->linesize[0]
+                                 size:frame_size
+                                 format:kCIFormatARGB8
+                                 colorSpace:ctx->color_space]; //kCGColorSpaceGenericRGB
     if (!ret) {
         av_log(ctx, AV_LOG_ERROR, "Input image could not be initialized.\n");
         return AVERROR_EXTERNAL;
     }
 
-    CIFilter *filter       = NULL;
-    CIImage *filter_input  = (__bridge CIImage*)ctx->input_image;
-    CIImage *filter_output = NULL;
-
     // successively apply all filters
     for (i = 0; i < ctx->num_filters; i++) {
         if (i) {
             // set filter input to previous filter output
             filter_input    = [(__bridge CIImage*)ctx->filters[i-1] valueForKey:kCIOutputImageKey];
-            CGRect out_rect = [filter_input extent];
+            out_rect = [filter_input extent];
             if (out_rect.size.width > frame->width || out_rect.size.height > frame->height) {
                 // do not keep padded image regions after filtering
                 out_rect.origin.x    = 0.0f;
@@ -206,7 +207,7 @@ static int apply_filter(CoreImageContext *ctx, AVFilterLink *link, AVFrame *fram
     }
 
     // do not keep padded image regions after filtering
-    CGRect out_rect = [filter_output extent];
+    out_rect = [filter_output extent];
     if (out_rect.size.width > frame->width || out_rect.size.height > frame->height) {
         av_log(ctx, AV_LOG_DEBUG, "Cropping output image.\n");
         out_rect.origin.x    = 0.0f;
@@ -215,8 +216,8 @@ static int apply_filter(CoreImageContext *ctx, AVFilterLink *link, AVFrame *fram
         out_rect.size.height = frame->height;
     }
 
-    CGImageRef out = [(__bridge CIContext*)ctx->glctx createCGImage:filter_output
-                                                      fromRect:out_rect];
+    out = [(__bridge CIContext*)ctx->glctx createCGImage:filter_output
+                                           fromRect:out_rect];
 
     if (!out) {
         av_log(ctx, AV_LOG_ERROR, "Cannot create valid output image.\n");
@@ -227,12 +228,10 @@ static int apply_filter(CoreImageContext *ctx, AVFilterLink *link, AVFrame *fram
         CGContextRelease(ctx->cgctx);
         ctx->cgctx = NULL;
     }
-    size_t out_width  = CGImageGetWidth(out);
-    size_t out_height = CGImageGetHeight(out);
 
-    if (out_width > frame->width || out_height > frame->height) { // this might result in segfault
+    if (CGImageGetWidth(out) > frame->width || CGImageGetHeight(out) > frame->height) { // this might result in segfault
         av_log(ctx, AV_LOG_WARNING, "Output image has unexpected size: %lux%lu (expected: %ix%i). This may crash...\n",
-               out_width, out_height, frame->width, frame->height);
+               CGImageGetWidth(out), CGImageGetHeight(out), frame->width, frame->height);
     }
     ctx->cgctx = CGBitmapContextCreate(frame->data[0],
                                        frame->width,
@@ -247,25 +246,25 @@ static int apply_filter(CoreImageContext *ctx, AVFilterLink *link, AVFrame *fram
     }
 
     // copy ("draw") the output image into the frame data
-    CGRect rect = {{0,0},{frame->width, frame->height}};
+    out_rect = CGRectMake(0, 0, frame->width, frame->height);
     if (ctx->output_rect) {
         @try {
             NSString *tmp_string = [NSString stringWithUTF8String:ctx->output_rect];
             NSRect tmp           = NSRectFromString(tmp_string);
-            rect                 = NSRectToCGRect(tmp);
+            out_rect             = NSRectToCGRect(tmp);
         } @catch (NSException *exception) {
             av_log(ctx, AV_LOG_ERROR, "An error occurred: %s.", [exception.reason UTF8String]);
             return AVERROR_EXTERNAL;
         }
-        if (rect.size.width == 0.0f) {
+        if (out_rect.size.width == 0.0f) {
             av_log(ctx, AV_LOG_WARNING, "Width of output rect is zero.\n");
         }
-        if (rect.size.height == 0.0f) {
+        if (out_rect.size.height == 0.0f) {
             av_log(ctx, AV_LOG_WARNING, "Height of output rect is zero.\n");
         }
     }
 
-    CGContextDrawImage(ctx->cgctx, rect, out);
+    CGContextDrawImage(ctx->cgctx, out_rect, out);
 
     return ff_filter_frame(link, frame);
 }
@@ -434,6 +433,7 @@ static void set_option(CoreImageContext *ctx, CIFilter *filter, const char *key,
 
 static av_cold int init(AVFilterContext *fctx)
 {
+    NSOpenGLPixelFormat *pixel_format;
     CoreImageContext *ctx       = fctx->priv;
     AVDictionary *filter_dict   = NULL;
     const AVDictionaryEntry *f  = NULL;
@@ -504,14 +504,12 @@ static av_cold int init(AVFilterContext *fctx)
     }
 
     // create GPU context on OSX
-    const NSOpenGLPixelFormatAttribute attr[] = {
+    pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:(const NSOpenGLPixelFormatAttribute[]){
         NSOpenGLPFAAccelerated,
         NSOpenGLPFANoRecovery,
         NSOpenGLPFAColorSize, 32,
         0
-    };
-
-    NSOpenGLPixelFormat *pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:(void *)&attr];
+    }];
     ctx->color_space                  = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
     ctx->glctx                        = CFBridgingRetain([CIContext contextWithCGLContext:CGLGetCurrentContext()
                                                          pixelFormat:[pixel_format CGLPixelFormatObj]
-- 
2.39.3 (Apple Git-146)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [FFmpeg-devel] [PATCH 08/11] avfilter/vf_coreimage: simplify list_filters code
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
                   ` (5 preceding siblings ...)
  2024-07-12 17:13 ` [FFmpeg-devel] [PATCH 07/11] avfilter/vf_coreimage: fix mixed declaration and code Marvin Scholz
@ 2024-07-12 17:19 ` Marvin Scholz
  2024-07-12 17:30 ` [FFmpeg-devel] [PATCH 09/11] avfilter/vf_coreimage: silence AVFrame deprecation warnings Marvin Scholz
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 17:19 UTC (permalink / raw)
  To: ffmpeg-devel

Use fast-enumeration and get rid of unnecessary intermediate variables.
---
 libavfilter/vf_coreimage.m | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index bfc17764b5..38355414bd 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -102,18 +102,13 @@ static void list_filters(CoreImageContext *ctx)
         filter_categories = [NSArray arrayWithObjects:kCICategoryGenerator, nil];
     }
 
-    NSArray *filter_names = [CIFilter filterNamesInCategories:filter_categories];
-    NSEnumerator *filters = [filter_names objectEnumerator];
-
-    NSString *filter_name;
-    while (filter_name = [filters nextObject]) {
-        CIFilter *filter             = [CIFilter filterWithName:filter_name];
-        NSDictionary *filter_attribs = [filter attributes]; // <nsstring, id>
-        NSArray      *filter_inputs  = [filter inputKeys];  // <nsstring>
+    for (NSString *filter_name in [CIFilter filterNamesInCategories:filter_categories]) {
+        CIFilter *filter = [CIFilter filterWithName:filter_name];
+        NSDictionary<NSString *, id> *filter_attribs = [filter attributes];
 
         av_log(ctx, AV_LOG_INFO, "Filter: %s\n", [filter_name UTF8String]);
 
-        for (NSString *input in filter_inputs) {
+        for (NSString *input in [filter inputKeys]) {
             NSDictionary *input_attribs = [filter_attribs valueForKey:input];
             NSString *input_class       = [input_attribs valueForKey:kCIAttributeClass];
             if ([input_class isEqualToString:@"NSNumber"]) {
-- 
2.39.3 (Apple Git-146)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [FFmpeg-devel] [PATCH 09/11] avfilter/vf_coreimage: silence AVFrame deprecation warnings
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
                   ` (6 preceding siblings ...)
  2024-07-12 17:19 ` [FFmpeg-devel] [PATCH 08/11] avfilter/vf_coreimage: simplify list_filters code Marvin Scholz
@ 2024-07-12 17:30 ` Marvin Scholz
  2024-07-12 17:36 ` [FFmpeg-devel] [PATCH 10/11] avfilter/yadif_common: remove unused variable Marvin Scholz
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 17:30 UTC (permalink / raw)
  To: ffmpeg-devel

Deprecation warning need to be disabled here as we set deprecated
fields.
---
 libavfilter/vf_coreimage.m | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index 38355414bd..45b16cc48a 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -296,14 +296,18 @@ static int request_frame(AVFilterLink *link)
 
     frame->pts                 = ctx->pts;
     frame->duration            = 1;
+    frame->flags              |= AV_FRAME_FLAG_KEY;
+    frame->flags              &= ~AV_FRAME_FLAG_INTERLACED;
+
+FF_DISABLE_DEPRECATION_WARNINGS
 #if FF_API_FRAME_KEY
     frame->key_frame           = 1;
 #endif
-    frame->flags              |= AV_FRAME_FLAG_KEY;
 #if FF_API_INTERLACED_FRAME
     frame->interlaced_frame    = 0;
 #endif
-    frame->flags              &= ~AV_FRAME_FLAG_INTERLACED;
+FF_ENABLE_DEPRECATION_WARNINGS
+
     frame->pict_type           = AV_PICTURE_TYPE_I;
     frame->sample_aspect_ratio = ctx->sar;
 
-- 
2.39.3 (Apple Git-146)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [FFmpeg-devel] [PATCH 10/11] avfilter/yadif_common: remove unused variable
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
                   ` (7 preceding siblings ...)
  2024-07-12 17:30 ` [FFmpeg-devel] [PATCH 09/11] avfilter/vf_coreimage: silence AVFrame deprecation warnings Marvin Scholz
@ 2024-07-12 17:36 ` Marvin Scholz
  2024-07-13  0:50   ` Andreas Rheinhardt
  2024-07-12 17:43 ` [FFmpeg-devel] [PATCH 11/11] avfilter/yadif_common: fix mixed declaration and code Marvin Scholz
  2024-07-15  8:39 ` [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: " Zhao Zhili
  10 siblings, 1 reply; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 17:36 UTC (permalink / raw)
  To: ffmpeg-devel

---
 libavfilter/vf_yadif_videotoolbox.m | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavfilter/vf_yadif_videotoolbox.m b/libavfilter/vf_yadif_videotoolbox.m
index c47d3edfb8..eb7026395e 100644
--- a/libavfilter/vf_yadif_videotoolbox.m
+++ b/libavfilter/vf_yadif_videotoolbox.m
@@ -172,7 +172,6 @@ static void filter(AVFilterContext *ctx, AVFrame *dst,
 static av_cold void do_uninit(AVFilterContext *ctx) API_AVAILABLE(macos(10.11), ios(8.0))
 {
     YADIFVTContext *s = ctx->priv;
-    YADIFContext *y = &s->yadif;
 
     ff_yadif_uninit(ctx);
 
-- 
2.39.3 (Apple Git-146)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [FFmpeg-devel] [PATCH 11/11] avfilter/yadif_common: fix mixed declaration and code
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
                   ` (8 preceding siblings ...)
  2024-07-12 17:36 ` [FFmpeg-devel] [PATCH 10/11] avfilter/yadif_common: remove unused variable Marvin Scholz
@ 2024-07-12 17:43 ` Marvin Scholz
  2024-07-15  8:39 ` [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: " Zhao Zhili
  10 siblings, 0 replies; 15+ messages in thread
From: Marvin Scholz @ 2024-07-12 17:43 UTC (permalink / raw)
  To: ffmpeg-devel

Fix a "mixing declarations and code is incompatible with standards
before C99" warning.
---
 libavfilter/vf_yadif_videotoolbox.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_yadif_videotoolbox.m b/libavfilter/vf_yadif_videotoolbox.m
index eb7026395e..5cc7585f3f 100644
--- a/libavfilter/vf_yadif_videotoolbox.m
+++ b/libavfilter/vf_yadif_videotoolbox.m
@@ -205,6 +205,7 @@ static av_cold int do_init(AVFilterContext *ctx) API_AVAILABLE(macos(10.11), ios
     YADIFVTContext *s = ctx->priv;
     NSError *err = nil;
     CVReturn ret;
+    dispatch_data_t libData;
 
     s->mtlDevice = MTLCreateSystemDefaultDevice();
     if (!s->mtlDevice) {
@@ -214,7 +215,7 @@ static av_cold int do_init(AVFilterContext *ctx) API_AVAILABLE(macos(10.11), ios
 
     av_log(ctx, AV_LOG_INFO, "Using Metal device: %s\n", s->mtlDevice.name.UTF8String);
 
-    dispatch_data_t libData = dispatch_data_create(
+    libData = dispatch_data_create(
         ff_vf_yadif_videotoolbox_metallib_data,
         ff_vf_yadif_videotoolbox_metallib_len,
         nil,
-- 
2.39.3 (Apple Git-146)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [FFmpeg-devel] [PATCH 10/11] avfilter/yadif_common: remove unused variable
  2024-07-12 17:36 ` [FFmpeg-devel] [PATCH 10/11] avfilter/yadif_common: remove unused variable Marvin Scholz
@ 2024-07-13  0:50   ` Andreas Rheinhardt
  2024-07-13 14:47     ` epirat07
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Rheinhardt @ 2024-07-13  0:50 UTC (permalink / raw)
  To: ffmpeg-devel

Marvin Scholz:
> ---
>  libavfilter/vf_yadif_videotoolbox.m | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/libavfilter/vf_yadif_videotoolbox.m b/libavfilter/vf_yadif_videotoolbox.m
> index c47d3edfb8..eb7026395e 100644
> --- a/libavfilter/vf_yadif_videotoolbox.m
> +++ b/libavfilter/vf_yadif_videotoolbox.m
> @@ -172,7 +172,6 @@ static void filter(AVFilterContext *ctx, AVFrame *dst,
>  static av_cold void do_uninit(AVFilterContext *ctx) API_AVAILABLE(macos(10.11), ios(8.0))
>  {
>      YADIFVTContext *s = ctx->priv;
> -    YADIFContext *y = &s->yadif;
>  
>      ff_yadif_uninit(ctx);
>  

This is not yadif_common.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [FFmpeg-devel] [PATCH 10/11] avfilter/yadif_common: remove unused variable
  2024-07-13  0:50   ` Andreas Rheinhardt
@ 2024-07-13 14:47     ` epirat07
  0 siblings, 0 replies; 15+ messages in thread
From: epirat07 @ 2024-07-13 14:47 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



On 13 Jul 2024, at 2:50, Andreas Rheinhardt wrote:

> Marvin Scholz:
>> ---
>>  libavfilter/vf_yadif_videotoolbox.m | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/libavfilter/vf_yadif_videotoolbox.m b/libavfilter/vf_yadif_videotoolbox.m
>> index c47d3edfb8..eb7026395e 100644
>> --- a/libavfilter/vf_yadif_videotoolbox.m
>> +++ b/libavfilter/vf_yadif_videotoolbox.m
>> @@ -172,7 +172,6 @@ static void filter(AVFilterContext *ctx, AVFrame *dst,
>>  static av_cold void do_uninit(AVFilterContext *ctx) API_AVAILABLE(macos(10.11), ios(8.0))
>>  {
>>      YADIFVTContext *s = ctx->priv;
>> -    YADIFContext *y = &s->yadif;
>>
>>      ff_yadif_uninit(ctx);
>>
>
> This is not yadif_common.

Thanks, will be fixed in the next iteration.

>
> - Andreas
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [FFmpeg-devel] [PATCH 02/11] avfilter/af_channelsplit: fix mixed declaration and code
  2024-07-12 15:47 ` [FFmpeg-devel] [PATCH 02/11] avfilter/af_channelsplit: " Marvin Scholz
@ 2024-07-14 17:39   ` Leo Izen
  0 siblings, 0 replies; 15+ messages in thread
From: Leo Izen @ 2024-07-14 17:39 UTC (permalink / raw)
  To: ffmpeg-devel

On 7/12/24 11:47 AM, Marvin Scholz wrote:
> Fix a "mixing declarations and code is incompatible with standards
> before C99" warning.
> ---
>   libavfilter/af_channelsplit.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c
> index 43b2667750..b91195a4c6 100644
> --- a/libavfilter/af_channelsplit.c
> +++ b/libavfilter/af_channelsplit.c
> @@ -151,6 +151,7 @@ static int query_formats(AVFilterContext *ctx)
>   
>   static int filter_frame(AVFilterLink *outlink, AVFrame *buf)
>   {
> +    AVFrame *buf_out;
>       AVFilterContext *ctx = outlink->src;
>       ChannelSplitContext *s = ctx->priv;
>       const int i = FF_OUTLINK_IDX(outlink);
> @@ -159,7 +160,7 @@ static int filter_frame(AVFilterLink *outlink, AVFrame *buf)
>   
>       av_assert1(channel >= 0);
>   
> -    AVFrame *buf_out = av_frame_clone(buf);
> +    buf_out = av_frame_clone(buf);
>       if (!buf_out)
>           return AVERROR(ENOMEM);
>   

This LGTM, I submitted a similar patch.

- Leo Izen
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code
  2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
                   ` (9 preceding siblings ...)
  2024-07-12 17:43 ` [FFmpeg-devel] [PATCH 11/11] avfilter/yadif_common: fix mixed declaration and code Marvin Scholz
@ 2024-07-15  8:39 ` Zhao Zhili
  10 siblings, 0 replies; 15+ messages in thread
From: Zhao Zhili @ 2024-07-15  8:39 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


> On Jul 12, 2024, at 23:44, Marvin Scholz <epirat07@gmail.com> wrote:
> 
> Fix a bunch of "mixing declarations and code is incompatible with
> standards before C99" warnings.

Rather than fix the warning, can we disable the check for object-c as it's a
different language?

> ---
> libavdevice/audiotoolbox.m | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/libavdevice/audiotoolbox.m b/libavdevice/audiotoolbox.m
> index 7d95c34593..dd607589b4 100644
> --- a/libavdevice/audiotoolbox.m
> +++ b/libavdevice/audiotoolbox.m
> @@ -77,6 +77,9 @@ static av_cold int at_write_header(AVFormatContext *avctx)
>     ATContext *ctx = (ATContext*)avctx->priv_data;
>     OSStatus err = noErr;
>     CFStringRef device_UID = NULL;
> +    const char *stream_name = avctx->url;
> +    AVCodecParameters *codecpar = avctx->streams[0]->codecpar;
> +    AudioStreamBasicDescription device_format = {0};
>     AudioDeviceID *devices;
>     int num_devices;
> 
> @@ -133,7 +136,6 @@ static av_cold int at_write_header(AVFormatContext *avctx)
> 
>     // get user-defined device UID or use default device
>     // -audio_device_index overrides any URL given
> -    const char *stream_name = avctx->url;
>     if (stream_name && ctx->audio_device_index == -1) {
>         sscanf(stream_name, "%d", &ctx->audio_device_index);
>     }
> @@ -163,10 +165,8 @@ static av_cold int at_write_header(AVFormatContext *avctx)
>     }
> 
>     av_freep(&devices);
> -    AVCodecParameters *codecpar = avctx->streams[0]->codecpar;
> 
>     // audio format
> -    AudioStreamBasicDescription device_format = {0};
>     device_format.mSampleRate        = codecpar->sample_rate;
>     device_format.mFormatID          = kAudioFormatLinearPCM;
>     device_format.mFormatFlags      |= (codecpar->format == AV_SAMPLE_FMT_FLT) ? kLinearPCMFormatFlagIsFloat : 0;
> @@ -237,6 +237,7 @@ static av_cold int at_write_header(AVFormatContext *avctx)
> 
> static int at_write_packet(AVFormatContext *avctx, AVPacket *pkt)
> {
> +    AudioQueueBufferRef buf;
>     ATContext *ctx = (ATContext*)avctx->priv_data;
>     OSStatus err = noErr;
> 
> @@ -256,7 +257,7 @@ static int at_write_packet(AVFormatContext *avctx, AVPacket *pkt)
>         }
>     }
> 
> -    AudioQueueBufferRef buf = ctx->buffer[ctx->cur_buf];
> +    buf = ctx->buffer[ctx->cur_buf];
> 
>     // copy audio data into buffer and enqueue the buffer
>     memcpy(buf->mAudioData, pkt->data, buf->mAudioDataBytesCapacity);
> 
> base-commit: 85706f5136cf7c88f95843b2634dd3f7d7d2cb6d
> -- 
> 2.39.3 (Apple Git-146)
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-07-15  8:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-12 15:44 [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code Marvin Scholz
2024-07-12 15:47 ` [FFmpeg-devel] [PATCH 02/11] avfilter/af_channelsplit: " Marvin Scholz
2024-07-14 17:39   ` Leo Izen
2024-07-12 16:07 ` [FFmpeg-devel] [PATCH 03/11] avdevice/avfoundation: fix mixed declarations " Marvin Scholz
2024-07-12 16:09 ` [FFmpeg-devel] [PATCH 04/11] avdevice/avfoundation: remove write-only variable Marvin Scholz
2024-07-12 16:17 ` [FFmpeg-devel] [PATCH 05/11] lavfi/metal: fix mixed declaration and code Marvin Scholz
2024-07-12 16:21 ` [FFmpeg-devel] [PATCH 06/11] lavfi/metal: simplify fallback Marvin Scholz
2024-07-12 17:13 ` [FFmpeg-devel] [PATCH 07/11] avfilter/vf_coreimage: fix mixed declaration and code Marvin Scholz
2024-07-12 17:19 ` [FFmpeg-devel] [PATCH 08/11] avfilter/vf_coreimage: simplify list_filters code Marvin Scholz
2024-07-12 17:30 ` [FFmpeg-devel] [PATCH 09/11] avfilter/vf_coreimage: silence AVFrame deprecation warnings Marvin Scholz
2024-07-12 17:36 ` [FFmpeg-devel] [PATCH 10/11] avfilter/yadif_common: remove unused variable Marvin Scholz
2024-07-13  0:50   ` Andreas Rheinhardt
2024-07-13 14:47     ` epirat07
2024-07-12 17:43 ` [FFmpeg-devel] [PATCH 11/11] avfilter/yadif_common: fix mixed declaration and code Marvin Scholz
2024-07-15  8:39 ` [FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: " Zhao Zhili

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git