macos: fix build for arm64

Adds arm64 branches to some x86 specific code and modifies some casting
logic to make Clang happy
This commit is contained in:
sguo35 2022-04-04 12:37:10 -07:00 committed by Ivan
parent 219ddf3e11
commit e761b3235c
5 changed files with 20 additions and 5 deletions

View file

@ -166,7 +166,7 @@ namespace utils
struct scoped_av
{
AVFormatContext* format = nullptr;
AVCodec* codec = nullptr;
const AVCodec* codec = nullptr;
AVCodecContext* context = nullptr;
AVFrame* frame = nullptr;
SwrContext* swr = nullptr;
@ -180,8 +180,8 @@ namespace utils
swr_free(&swr);
if (context)
avcodec_close(context);
if (codec)
av_free(codec);
// AVCodec is managed by libavformat, no need to free it
// see: https://stackoverflow.com/a/18047320
if (format)
avformat_free_context(format);
}