diff --git a/libavcodec/audiotoolboxdec.c.orig b/libavcodec/audiotoolboxdec.c
index 5456f91..344c2fb 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -318,7 +318,11 @@ static av_cold int ffat_create_decoder(AVCodecContext *avctx,
     };
     AudioStreamBasicDescription out_format = {
         .mFormatID = kAudioFormatLinearPCM,
+#if defined HAVE_BIGENDIAN
+        .mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked | kAudioFormatFlagIsBigEndian,
+#else
         .mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked,
+#endif
         .mFramesPerPacket = 1,
         .mBitsPerChannel = av_get_bytes_per_sample(sample_fmt) * 8,
     };
@@ -347,7 +351,7 @@ static av_cold int ffat_create_decoder(AVCodecContext *avctx,
         enum AVCodecID codec_id;
         int bit_rate;
         if (ff_mpa_decode_header(AV_RB32(pkt->data), &avctx->sample_rate,
-                                 &in_format.mChannelsPerFrame, &avctx->frame_size,
+                                 (UInt32 *)&in_format.mChannelsPerFrame, &avctx->frame_size,
                                  &bit_rate, &codec_id) < 0)
             return AVERROR_INVALIDDATA;
         avctx->bit_rate = bit_rate;
@@ -544,7 +548,7 @@ static int ffat_decode(AVCodecContext *avctx, AVFrame *frame,
     out_buffers.mBuffers[0].mData = at->decoded_data;
 
     ret = AudioConverterFillComplexBuffer(at->converter, ffat_decode_callback, avctx,
-                                          &frame->nb_samples, &out_buffers, NULL);
+                                          (UInt32 *)&frame->nb_samples, &out_buffers, NULL);
     if ((!ret || ret == 1) && frame->nb_samples) {
         if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
             return ret;

diff --git a/libavcodec/audiotoolboxenc.c.orig b/libavcodec/audiotoolboxenc.c
index 42ab7ae..ac272de 100644
--- a/libavcodec/audiotoolboxenc.c
+++ b/libavcodec/audiotoolboxenc.c
@@ -244,7 +244,11 @@ static av_cold int ffat_init_encoder(AVCodecContext *avctx)
                           avctx->sample_fmt == AV_SAMPLE_FMT_DBL) ? kAudioFormatFlagIsFloat
                         : avctx->sample_fmt == AV_SAMPLE_FMT_U8 ? 0
                         : kAudioFormatFlagIsSignedInteger)
+#if defined HAVE_BIGENDIAN
+                        | kAudioFormatFlagIsPacked | kAudioFormatFlagIsBigEndian,
+#else
                         | kAudioFormatFlagIsPacked,
+#endif
         .mBytesPerPacket = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->ch_layout.nb_channels,
         .mFramesPerPacket = 1,
         .mBytesPerFrame = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->ch_layout.nb_channels,
@@ -379,7 +383,7 @@ static av_cold int ffat_init_encoder(AVCodecContext *avctx)
                               sizeof(at->quality), &at->quality);
 
     if (!AudioConverterGetPropertyInfo(at->converter, kAudioConverterCompressionMagicCookie,
-                                       &avctx->extradata_size, NULL) &&
+                                       (UInt32 *)&avctx->extradata_size, NULL) &&
         avctx->extradata_size) {
         int extradata_size = avctx->extradata_size;
         uint8_t *extradata;
@@ -396,7 +400,7 @@ static av_cold int ffat_init_encoder(AVCodecContext *avctx)
         }
         status = AudioConverterGetProperty(at->converter,
                                            kAudioConverterCompressionMagicCookie,
-                                           &extradata_size, extradata);
+                                           (UInt32 *)&extradata_size, extradata);
         if (status != 0) {
             av_log(avctx, AV_LOG_ERROR, "AudioToolbox cookie error: %i\n", (int)status);
             return AVERROR_UNKNOWN;
@@ -545,7 +549,7 @@ static int ffat_encode(AVCodecContext *avctx, AVPacket *avpkt,
     *got_packet_ptr = avctx->frame_size / at->frame_size;
 
     ret = AudioConverterFillComplexBuffer(at->converter, ffat_encode_callback, avctx,
-                                          got_packet_ptr, &out_buffers,
+                                          (UInt32 *)got_packet_ptr, &out_buffers,
                                           (avctx->frame_size > at->frame_size) ? NULL : &out_pkt_desc);
 
     ff_bufqueue_discard_all(&at->used_frame_queue);

