From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 77EBB49580 for ; Fri, 12 Jul 2024 17:48:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BDC4968DAE7; Fri, 12 Jul 2024 20:48:15 +0300 (EEST) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8A27568DA83 for ; Fri, 12 Jul 2024 20:48:06 +0300 (EEST) Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-52e9b9fb3dcso2770212e87.1 for ; Fri, 12 Jul 2024 10:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720806485; x=1721411285; darn=ffmpeg.org; h=subject:date:from:to:message-id:in-reply-to:from:to:cc:subject:date :message-id:reply-to; bh=G0jjar1SEmv2QTERPbu5Y+xv/Oswo3cqSDf69JWGE3M=; b=b6YXL4hIzl6yro60wJXV6fEDovuUq28RkbqCYz0xM5xrbS5yABDi63UJC+O06uLMpR VFFYPelffjF8e6YyUSafDPUscJFYOmDYu+cvES8DhlZSmrUlzT331tYqB0+b+sEOyqye ENEIJdMcIrO/Vf14nJ2wbNRJbyrgWyJMZVqzLdeHOdR/FAof4KB0fP3qCJGrO/34bjCp 0AI3jnObn3iWswdT8sKCEv1yx7xt2OkAM7FTA0+MaQ8NxTx151cOqXVXa+I6PV7kGbT5 fubKUCYmUPbY9txr46J6jH6HLafGk6deUhz35M+f+uDpLvnaCvmi7MM3+RmQbUKwiTYn lNSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720806485; x=1721411285; h=subject:date:from:to:message-id:in-reply-to:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=G0jjar1SEmv2QTERPbu5Y+xv/Oswo3cqSDf69JWGE3M=; b=TXuDf+K+vSCN2qjIecrIHoxDDXOv0Rr9wDFafDZgZ41t57akAol8CcNkn1DaWMBNwU t5XITqafvlxur9gyY025/4tWxAKZbZIH0EhFDryZ4H44pJuLuOoQuFKWMss6++jjK9hf c/B27wXK2oIBWJKcq5wd78XOOLSAfKL3BWYn02CQONcBBNpOV66ZsW+saXRc6pCU13a+ bYNOebvYxNtRnQa0aqgW47NCmGgM9N5k9IKZh6AKNYP5u4oqAY4w4PHeHHS0X50MY00Y 7rYxojAlvXSafNfqCR3p2oFzmgWxR5bTdglsogSKK4aoiReabqWLn/A/YKECGbv3LHhM 1YZw== X-Gm-Message-State: AOJu0YynYsYMqg8eoTwIhb130oJNdrVoMxvF/4yMdsDpAieUB9a7z0jf M7LZ25RceYkSydTJphVIKxqBDV496PTMyuGrkoH1eBw/UOm68IK2Aaze8w== X-Google-Smtp-Source: AGHT+IEyQiE8ODix0QXMZRxNZ5icf/V05SxOLlOqP3Iq2gODTrc/lHqrE8pwtgndwZcJSja4A5aidw== X-Received: by 2002:a2e:9903:0:b0:2ec:5fe1:c762 with SMTP id 38308e7fff4ca-2eeb3197c6fmr78560141fa.46.1720806485180; Fri, 12 Jul 2024 10:48:05 -0700 (PDT) Received: from localhost (p200300cccf1e25001072fbc25e6664b9.dip0.t-ipconnect.de. [2003:cc:cf1e:2500:1072:fbc2:5e66:64b9]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-594bd45a1b6sm4753150a12.60.2024.07.12.10.48.04 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Jul 2024 10:48:04 -0700 (PDT) In-Reply-To: Message-Id: To: From: "Marvin Scholz" Date: Fri, 12 Jul 2024 18:07:00 +0200 Subject: [FFmpeg-devel] [PATCH 03/11] avdevice/avfoundation: fix mixed declarations and code X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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".