static struct va_pic_context *CreatePicContext(IDirect3DSurface9 *surface) { struct va_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx)); if (unlikely(pic_ctx==NULL)) return NULL; pic_ctx->s.destroy = d3d9_pic_context_destroy; pic_ctx->s.copy = d3d9_pic_context_copy; pic_ctx->picsys.surface = surface; AcquirePictureSys(&pic_ctx->picsys); return pic_ctx; }
static struct picture_context_t *d3d9_pic_context_copy(struct picture_context_t *ctx) { struct va_pic_context *src_ctx = (struct va_pic_context*)ctx; struct va_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx)); if (unlikely(pic_ctx==NULL)) return NULL; pic_ctx->s.destroy = d3d9_pic_context_destroy; pic_ctx->s.copy = d3d9_pic_context_copy; pic_ctx->picsys = src_ctx->picsys; AcquirePictureSys(&pic_ctx->picsys); return &pic_ctx->s; }
static picture_t *NewOutputPicture( filter_t *p_filter ) { picture_t *pic = p_filter->p_sys->buffer_new( p_filter ); if ( !pic->context ) { /* the picture might be duplicated for snapshots so it needs a context */ assert( pic->p_sys != NULL ); /* this opaque picture is wrong */ struct va_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx)); if (likely(pic_ctx!=NULL)) { pic_ctx->s.destroy = d3d9_pic_context_destroy; pic_ctx->s.copy = d3d9_pic_context_copy; pic_ctx->picsys = *pic->p_sys; AcquirePictureSys( &pic_ctx->picsys ); pic->context = &pic_ctx->s; } } return pic; }