[FFmpeg-devel] [PATCH 01/11] avdevice/audiotoolbox: fix mixed declaration and code

Zhao Zhili quinkblack at foxmail.com
Mon Jul 15 11:39:52 EEST 2024


> On Jul 12, 2024, at 23:44, Marvin Scholz <epirat07 at 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 at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list