⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vdpau_video.c

📁 nvidia VDPAU 驱动与intel VAAPI 驱动桥接的接口实现。 VAAPI intel 视频解码驱动接口函数库 VDPAU:nvdia视频解码驱动接口函数库
💻 C
📖 第 1 页 / 共 5 页
字号:
    int i;    obj_config = CONFIG(config_id);    ASSERT(obj_config);    if (obj_config == NULL)	return VA_STATUS_ERROR_INVALID_CONFIG;    if (profile)	*profile = obj_config->profile;    if (entrypoint)	*entrypoint = obj_config->entrypoint;    if (num_attribs)	*num_attribs =  obj_config->attrib_count;    if (attrib_list) {	for (i = 0; i < obj_config->attrib_count; i++)	    attrib_list[i] = obj_config->attrib_list[i];    }    return va_status;}// vaDestroySurfacesstatic VAStatusvdpau_DestroySurfaces(VADriverContextP ctx,		      VASurfaceID *surface_list,		      int num_surfaces){    INIT_DRIVER_DATA;    int i;    for (i = num_surfaces - 1; i >= 0; i--) {	object_surface_p obj_surface = SURFACE(surface_list[i]);	ASSERT(obj_surface);	if (obj_surface->vdp_surface != VDP_INVALID_HANDLE) {	    vdpau_video_surface_destroy(driver_data, obj_surface->vdp_surface);	    obj_surface->vdp_surface = VDP_INVALID_HANDLE;	}	object_heap_free(&driver_data->surface_heap, (object_base_p)obj_surface);    }    return VA_STATUS_SUCCESS;}// vaCreateSurfacesstatic VAStatusvdpau_CreateSurfaces(VADriverContextP ctx,		     int width,		     int height,		     int format,		     int num_surfaces,		     VASurfaceID *surfaces)		/* out */{    INIT_DRIVER_DATA;    VAStatus va_status = VA_STATUS_SUCCESS;    VdpVideoSurface vdp_surface = VDP_INVALID_HANDLE;    VdpStatus vdp_status;    int i;    /* We only support one format */    if (format != VA_RT_FORMAT_YUV420)	return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;    driver_data->vdp_chroma_format = get_VdpChromaType(format);    for (i = 0; i < num_surfaces; i++) {	vdp_status = vdpau_video_surface_create(driver_data,						driver_data->vdp_device,						driver_data->vdp_chroma_format,						width, height,						&vdp_surface);	if (vdp_status != VDP_STATUS_OK) {	    va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;	    break;	}        int va_surface = object_heap_allocate(&driver_data->surface_heap);	object_surface_p obj_surface;	if ((obj_surface = SURFACE(va_surface)) == NULL) {            va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;            break;        }	obj_surface->va_context = 0;	obj_surface->vdp_surface = vdp_surface;        surfaces[i] = va_surface;	vdp_surface = VDP_INVALID_HANDLE;    }    /* Error recovery */    if (va_status != VA_STATUS_SUCCESS) {	if (vdp_surface != VDP_INVALID_HANDLE)	    vdpau_video_surface_destroy(driver_data, vdp_surface);	vdpau_DestroySurfaces(ctx, surfaces, i);    }    return va_status;}// vaQueryImageFormatsstatic VAStatusvdpau_QueryImageFormats(VADriverContextP ctx,			VAImageFormat *format_list,	/* out */			int *num_formats)		/* out */{    INIT_DRIVER_DATA;    if (num_formats)	*num_formats = 0;    if (format_list == NULL)	return VA_STATUS_SUCCESS;    typedef struct {	VdpImageFormatType type;	uint32_t format;	VAImageFormat va_format;    } image_format_map_t;    static const image_format_map_t image_formats_map[] = {#define DEF(TYPE, FORMAT) \	VDP_IMAGE_FORMAT_TYPE_##TYPE, VDP_##TYPE##_FORMAT_##FORMAT#define DEF_YUV(TYPE, FORMAT, FOURCC, ENDIAN, BPP) \	{ DEF(TYPE, FORMAT), { VA_FOURCC FOURCC, VA_##ENDIAN##_FIRST, BPP, } }#define DEF_RGB(TYPE, FORMAT, FOURCC, ENDIAN, BPP, DEPTH, R,G,B,A) \	{ DEF(TYPE, FORMAT), { VA_FOURCC FOURCC, VA_##ENDIAN##_FIRST, BPP, DEPTH, R,G,B,A } }	DEF_YUV(YCBCR, NV12,	('N','V','1','2'), LSB, 12),	DEF_YUV(YCBCR, UYVY,	('U','Y','V','Y'), LSB, 16),	DEF_YUV(YCBCR, YUYV,	('Y','U','Y','V'), LSB, 16),	DEF_YUV(YCBCR, V8U8Y8A8,('A','Y','U','V'), LSB, 32),#ifdef WORDS_BIGENDIAN	DEF_RGB(RGBA, B8G8R8A8,	('A','R','G','B'), MSB, 32,		32, 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff),	DEF_RGB(RGBA, R8G8B8A8,	('A','B','G','R'), MSB, 32,		32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff),#else	DEF_RGB(RGBA, B8G8R8A8,	('B','G','R','A'), LSB, 32,		32, 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff),	DEF_RGB(RGBA, R8G8B8A8,	('R','G','B','A'), LSB, 32,		32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff),#endif#undef DEF_RGB#undef DEF_YUV#undef DEF    };    int i, n = 0;    for (i = 0; i < ARRAY_ELEMS(image_formats_map); i++) {	const image_format_map_t * const f = &image_formats_map[i];	if (vdpau_is_supported_image_format(driver_data, f->type, f->format))	    format_list[n++] = f->va_format;    }    /* If the assert fails then VDPAU_MAX_IMAGE_FORMATS needs to be bigger */    ASSERT(n <= VDPAU_MAX_IMAGE_FORMATS);    if (num_formats)	*num_formats = n;    return VA_STATUS_SUCCESS;}// vaCreateImagestatic VAStatusvdpau_CreateImage(VADriverContextP ctx,		  VAImageFormat *format,		  int width,		  int height,		  VAImage *image)			/* out */{    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaDeriveImagestatic VAStatusvdpau_DeriveImage(VADriverContextP ctx,		  VASurfaceID surface,		  VAImage *image)			/* out */{    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaDestroyImagestatic VAStatusvdpau_DestroyImage(VADriverContextP ctx,		   VAImageID image){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaSetImagePalettestatic VAStatusvdpau_SetImagePalette(VADriverContextP ctx,		      VAImageID image,		      unsigned char *palette){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaGetImagestatic VAStatusvdpau_GetImage(VADriverContextP ctx,	       VASurfaceID surface,	       int x,     /* coordinates of the upper left source pixel */	       int y,	       unsigned int width, /* width and height of the region */	       unsigned int height,	       VAImageID image){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaPutImagestatic VAStatusvdpau_PutImage(VADriverContextP ctx,	       VASurfaceID surface,	       VAImageID image,	       int src_x,	       int src_y,	       unsigned int width,	       unsigned int height,	       int dest_x,	       int dest_y){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaPutImage2static VAStatusvdpau_PutImage2(VADriverContextP ctx,		VASurfaceID surface,		VAImageID image,		int src_x,		int src_y,		unsigned int src_width,		unsigned int src_height,		int dest_x,		int dest_y,		unsigned int dest_width,		unsigned int dest_height){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaQuerySubpictureFormatsstatic VAStatusvdpau_QuerySubpictureFormats(VADriverContextP ctx,			     VAImageFormat *format_list,/* out */			     unsigned int *flags,	/* out */			     unsigned int *num_formats)	/* out */{    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaCreateSubpicturestatic VAStatusvdpau_CreateSubpicture(VADriverContextP ctx,		       VAImageID image,		       VASubpictureID *subpicture)	/* out */{    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaDestroySubpicturestatic VAStatusvdpau_DestroySubpicture(VADriverContextP ctx,			VASubpictureID subpicture){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaSetSubpictureImagestatic VAStatusvdpau_SetSubpictureImage(VADriverContextP ctx,			 VASubpictureID subpicture,			 VAImageID image){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaSetSubpicturePalette (not a PUBLIC interface)static VAStatusvdpau_SetSubpicturePalette(VADriverContextP ctx,			   VASubpictureID subpicture,			   unsigned char *palette){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaSetSubpictureChromaKeystatic VAStatusvdpau_SetSubpictureChromakey(VADriverContextP ctx,			     VASubpictureID subpicture,			     unsigned int chromakey_min,			     unsigned int chromakey_max,			     unsigned int chromakey_mask){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaSetSubpictureGlobalAlphastatic VAStatusvdpau_SetSubpictureGlobalAlpha(VADriverContextP ctx,			       VASubpictureID subpicture,			       float global_alpha){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaAssociateSubpicturestatic VAStatusvdpau_AssociateSubpicture(VADriverContextP ctx,			  VASubpictureID subpicture,			  VASurfaceID *target_surfaces,			  int num_surfaces,			  short src_x, /* upper left offset in subpicture */			  short src_y,			  short dest_x, /* upper left offset in surface */			  short dest_y,			  unsigned short width,			  unsigned short height,			  unsigned int flags){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaAssociateSubpicture2static VAStatusvdpau_AssociateSubpicture2(VADriverContextP ctx,			   VASubpictureID subpicture,			   VASurfaceID *target_surfaces,			   int num_surfaces,			   short src_x, /* upper left offset in subpicture */			   short src_y,			   unsigned short src_width,			   unsigned short src_height,			   short dest_x, /* upper left offset in surface */			   short dest_y,			   unsigned short dest_width,			   unsigned short dest_height,			   unsigned int flags){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaDeassociateSubpicturestatic VAStatusvdpau_DeassociateSubpicture(VADriverContextP ctx,			    VASubpictureID subpicture,			    VASurfaceID *target_surfaces,			    int num_surfaces){    INIT_DRIVER_DATA;    /* TODO */    return VA_STATUS_SUCCESS;}// vaDestroyContextstatic VAStatusvdpau_DestroyContext(VADriverContextP ctx,		     VAContextID context){    INIT_DRIVER_DATA;    int i;    object_context_p obj_context = CONTEXT(context);    ASSERT(obj_context);    if (obj_context == NULL)	return VA_STATUS_ERROR_INVALID_CONTEXT;    if (obj_context->vdp_video_surfaces) {	for (i = 0; i < obj_context->num_render_targets; i++) {	    VdpVideoSurface surface = obj_context->vdp_video_surfac

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -