diff --git a/src/torchcodec/decoders/_core/CudaDevice.cpp b/src/torchcodec/decoders/_core/CudaDevice.cpp index 55f4ab47..6ab80961 100644 --- a/src/torchcodec/decoders/_core/CudaDevice.cpp +++ b/src/torchcodec/decoders/_core/CudaDevice.cpp @@ -9,7 +9,6 @@ #include "src/torchcodec/decoders/_core/VideoDecoder.h" extern "C" { -#include #include #include } @@ -266,14 +265,15 @@ std::optional findCudaCodec( throwErrorIfNonCudaDevice(device); void* i = nullptr; - while ((AVCodec* codec = av_codec_iterate(&i)) != nullptr) { + const AVCodec** codec = nullptr; + while ((*codec = av_codec_iterate(&i)) != nullptr) { if (codec->id != codecId || !av_codec_is_decoder(codec)) { continue; } - for (int j = 0; - (AVCodecHWConfig* config = avcodec_get_hw_config(codec, j)) != nullptr; - j++) { + const AVCodecHWConfig** config = nullptr; + for (int j = 0; (*config = avcodec_get_hw_config(codec, j)) != nullptr; + ++j) { if (config->device_type == AV_HWDEVICE_TYPE_CUDA) { return codec; } diff --git a/src/torchcodec/decoders/_core/DeviceInterface.h b/src/torchcodec/decoders/_core/DeviceInterface.h index 289308cb..5ae201d2 100644 --- a/src/torchcodec/decoders/_core/DeviceInterface.h +++ b/src/torchcodec/decoders/_core/DeviceInterface.h @@ -13,10 +13,6 @@ #include "FFMPEGCommon.h" #include "src/torchcodec/decoders/_core/VideoDecoder.h" -extern "C" { -#include -} - namespace facebook::torchcodec { // Note that all these device functions should only be called if the device is