  
    int ret = av_hwdevice_ctx_create(&hw_device_ctx, hw_device_type, nullptr, nullptr, 0);
    if (ret < 0) {
      hw_pix_fmt = AV_PIX_FMT_NONE;
      has_cuda_device = false;
      rWarning("Failed to create specified HW device %d.", ret);
      return false;
    }
  
    decoder_ctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
 
</s> remove   bool load(const std::string &url, bool no_cuda = false, std::atomic<bool> *abort = nullptr, bool local_cache = false, int chunk_size = -1, int retries = 0);
  bool load(const std::byte *data, size_t size, bool no_cuda = false, std::atomic<bool> *abort = nullptr);
 </s> add   bool load(const std::string &url, bool no_hw_decoder = false, std::atomic<bool> *abort = nullptr, bool local_cache = false, int chunk_size = -1, int retries = 0);
  bool load(const std::byte *data, size_t size, bool no_hw_decoder = false, std::atomic<bool> *abort = nullptr); </s> remove   inline static std::atomic<bool> has_cuda_device = true;
 </s> add   inline static std::atomic<bool> has_hw_decoder = true; </s> remove   if (has_cuda_device && !no_cuda) {
    if (!initHardwareDecoder(AV_HWDEVICE_TYPE_CUDA)) {
      rWarning("No CUDA capable device was found. fallback to CPU decoding.");
 </s> add   if (has_hw_decoder && !no_hw_decoder) {
    if (!initHardwareDecoder(HW_DEVICE_TYPE)) {
      rWarning("No device with hardware decoder found. fallback to CPU decoding."); </s> remove     success = frames[id]->load(file, flags & REPLAY_FLAG_NO_CUDA, &abort_, local_cache, 20 * 1024 * 1024, 3);
 </s> add     success = frames[id]->load(file, flags & REPLAY_FLAG_NO_HW_DECODER, &abort_, local_cache, 20 * 1024 * 1024, 3); </s> remove   rWarning("Please run replay with the --no-cuda flag!");
 </s> add   rWarning("Please run replay with the --no-hw-decoder flag!");
    has_hw_decoder = false;
  
    int ret = av_hwdevice_ctx_create(&hw_device_ctx, hw_device_type, nullptr, nullptr, 0);
    if (ret < 0) {
      hw_pix_fmt = AV_PIX_FMT_NONE;
    has_hw_decoder = false;
      rWarning("Failed to create specified HW device %d.", ret);
      return false;
    }
  
    decoder_ctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
keep keep keep keep replace keep keep keep keep keep
 replay: use VideoToolbox HW decoder on Mac (#23832)

* replay: support VideoToolbox HW decoding

* rename flag

* remove debug assert 
selfdrive/ui/replay/framereader.cc