  #include "cereal/visionipc/visionbuf.h"
  
  namespace {
  
  struct buffer_data {
    const uint8_t *data;
    int64_t offset;
    size_t size;
 
</s> remove bool FrameReader::load(const std::byte *data, size_t size, bool no_cuda, std::atomic<bool> *abort) {
 </s> add bool FrameReader::load(const std::byte *data, size_t size, bool no_hw_decoder, std::atomic<bool> *abort) { </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   if (hw_pix_fmt == AV_PIX_FMT_CUDA) {
 </s> add   if (hw_pix_fmt == HW_PIX_FMT) { </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   return load((std::byte *)data.data(), data.size(), no_cuda, abort);
 </s> add   return load((std::byte *)data.data(), data.size(), no_hw_decoder, abort);
#ifdef __APPLE__
#define HW_DEVICE_TYPE AV_HWDEVICE_TYPE_VIDEOTOOLBOX
#define HW_PIX_FMT AV_PIX_FMT_VIDEOTOOLBOX
#else
#define HW_DEVICE_TYPE AV_HWDEVICE_TYPE_CUDA
#define HW_PIX_FMT AV_PIX_FMT_CUDA
#endif

  #include "cereal/visionipc/visionbuf.h"
  
#ifdef __APPLE__
#define HW_DEVICE_TYPE AV_HWDEVICE_TYPE_VIDEOTOOLBOX
#define HW_PIX_FMT AV_PIX_FMT_VIDEOTOOLBOX
#else
#define HW_DEVICE_TYPE AV_HWDEVICE_TYPE_CUDA
#define HW_PIX_FMT AV_PIX_FMT_CUDA
#endif

  namespace {
  
  struct buffer_data {
    const uint8_t *data;
    int64_t offset;
    size_t size;
keep add keep 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