ImageRawPtr VaapiImage::map(VideoDataMemoryType memoryType) { ImageRawPtr raw = m_rawImage.lock(); if (raw) { if (raw->getMemoryType() != memoryType) { ERROR("map image to different memory type, wanted %d, mapped = %d", memoryType, raw->getMemoryType()); raw.reset(); } return raw; } raw = VaapiImageRaw::create(m_display, shared_from_this(), memoryType); m_rawImage = raw; return raw; }
ImageRawPtr mapVaapiImage(ImagePtr img, VideoDataMemoryType memoryType) { ImageRawPtr raw = img->m_rawImage.lock(); if (raw) { if (raw->getMemoryType() != memoryType) { ERROR("map image to different memory type, wanted %d, mapped = %d", memoryType, raw->getMemoryType()); raw.reset(); } return raw; } raw = VaapiImageRaw::create(img->m_display, img, memoryType); img->m_rawImage = raw; return raw; }