static struct h265_video_private *get_surface_priv(struct h265_private *p, video_surface_ctx_t *surface) { struct h265_video_private *vp = surface->decoder_private; if (!vp) { vp = calloc(1, sizeof(*vp)); if (!vp) return NULL; vp->extra_data = cedrus_mem_alloc(surface->device->cedrus, PicSizeInCtbsY * 160); if (!vp->extra_data) { free(vp); return NULL; } surface->decoder_private = vp; surface->decoder_private_free = h265_video_private_free; } return vp; }
VdpStatus rgba_create(rgba_surface_t *rgba, device_ctx_t *device, uint32_t width, uint32_t height, VdpRGBAFormat format) { if (format != VDP_RGBA_FORMAT_B8G8R8A8 && format != VDP_RGBA_FORMAT_R8G8B8A8) return VDP_STATUS_INVALID_RGBA_FORMAT; if (width < 1 || width > 8192 || height < 1 || height > 8192) return VDP_STATUS_INVALID_SIZE; rgba->device = sref(device); rgba->width = width; rgba->height = height; rgba->format = format; if (device->osd_enabled) { rgba->data = cedrus_mem_alloc(device->cedrus, width * height * 4); if (!rgba->data) return VDP_STATUS_RESOURCES; if(!device->g2d_enabled) vdp_pixman_ref(rgba); rgba->dirty.x0 = width; rgba->dirty.y0 = height; rgba->dirty.x1 = 0; rgba->dirty.y1 = 0; rgba_fill(rgba, NULL, 0x00000000); rgba->id = 1; rgba->gl = 0; } return VDP_STATUS_OK; }