    enum AVPixelFormat *hw_pix_fmt = reinterpret_cast<enum AVPixelFormat *>(ctx->opaque);
    for (const enum AVPixelFormat *p = pix_fmts; *p != -1; p++) {
      if (*p == *hw_pix_fmt) return *p;
    }
    rWarning("Please run replay with the --no-cuda flag!");
    // fallback to YUV420p
    *hw_pix_fmt = AV_PIX_FMT_NONE;
    return AV_PIX_FMT_YUV420P;
  }
  
 
</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     has_cuda_device = false;
 </s> add     has_hw_decoder = false; </s> remove   REPLAY_FLAG_NO_CUDA = 0x0100,
 </s> add   REPLAY_FLAG_NO_HW_DECODER = 0x0100, </s> remove   if (hw_pix_fmt == AV_PIX_FMT_CUDA) {
 </s> add   if (hw_pix_fmt == HW_PIX_FMT) {
  rWarning("Please run replay with the --no-hw-decoder flag!");
    enum AVPixelFormat *hw_pix_fmt = reinterpret_cast<enum AVPixelFormat *>(ctx->opaque);
    for (const enum AVPixelFormat *p = pix_fmts; *p != -1; p++) {
      if (*p == *hw_pix_fmt) return *p;
    }
  rWarning("Please run replay with the --no-hw-decoder flag!");
    // fallback to YUV420p
    *hw_pix_fmt = AV_PIX_FMT_NONE;
    return AV_PIX_FMT_YUV420P;
  }
  
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