本文整理汇总了C++中VL_VA_DRIVER函数的典型用法代码示例。如果您正苦于以下问题:C++ VL_VA_DRIVER函数的具体用法?C++ VL_VA_DRIVER怎么用?C++ VL_VA_DRIVER使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VL_VA_DRIVER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vlVaDestroyBuffer
VAStatus
vlVaDestroyBuffer(VADriverContextP ctx, VABufferID buf_id)
{
vlVaBuffer *buf;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
buf = handle_table_get(VL_VA_DRIVER(ctx)->htab, buf_id);
if (!buf)
return VA_STATUS_ERROR_INVALID_BUFFER;
if (buf->derived_surface.resource) {
if (buf->export_refcount > 0)
return VA_STATUS_ERROR_INVALID_BUFFER;
pipe_resource_reference(&buf->derived_surface.resource, NULL);
}
FREE(buf->data);
FREE(buf);
handle_table_remove(VL_VA_DRIVER(ctx)->htab, buf_id);
return VA_STATUS_SUCCESS;
}
示例2: vlVaDestroyBuffer
VAStatus
vlVaDestroyBuffer(VADriverContextP ctx, VABufferID buf_id)
{
vlVaDriver *drv;
vlVaBuffer *buf;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
mtx_lock(&drv->mutex);
buf = handle_table_get(drv->htab, buf_id);
if (!buf) {
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_INVALID_BUFFER;
}
if (buf->derived_surface.resource)
pipe_resource_reference(&buf->derived_surface.resource, NULL);
FREE(buf->data);
FREE(buf);
handle_table_remove(VL_VA_DRIVER(ctx)->htab, buf_id);
mtx_unlock(&drv->mutex);
return VA_STATUS_SUCCESS;
}
示例3: vlVaDestroyConfig
VAStatus
vlVaDestroyConfig(VADriverContextP ctx, VAConfigID config_id)
{
vlVaDriver *drv;
vlVaConfig *config;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
if (!drv)
return VA_STATUS_ERROR_INVALID_CONTEXT;
pipe_mutex_lock(drv->mutex);
config = handle_table_get(drv->htab, config_id);
if (!config)
return VA_STATUS_ERROR_INVALID_CONFIG;
FREE(config);
handle_table_remove(drv->htab, config_id);
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_SUCCESS;
}
示例4: vlVaDestroyImage
VAStatus
vlVaDestroyImage(VADriverContextP ctx, VAImageID image)
{
VAImage *vaimage;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
vaimage = handle_table_get(VL_VA_DRIVER(ctx)->htab, image);
if (!vaimage)
return VA_STATUS_ERROR_INVALID_IMAGE;
handle_table_remove(VL_VA_DRIVER(ctx)->htab, image);
FREE(vaimage);
return vlVaDestroyBuffer(ctx, vaimage->buf);
}
示例5: vlVaReleaseBufferHandle
VAStatus
vlVaReleaseBufferHandle(VADriverContextP ctx, VABufferID buf_id)
{
vlVaBuffer *buf;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
buf = handle_table_get(VL_VA_DRIVER(ctx)->htab, buf_id);
if (!buf)
return VA_STATUS_ERROR_INVALID_BUFFER;
if (buf->export_refcount == 0)
return VA_STATUS_ERROR_INVALID_BUFFER;
if (--buf->export_refcount == 0) {
VABufferInfo * const buf_info = &buf->export_state;
switch (buf_info->mem_type) {
case VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME:
close((intptr_t)buf_info->handle);
break;
default:
return VA_STATUS_ERROR_INVALID_BUFFER;
}
buf_info->mem_type = 0;
}
return VA_STATUS_SUCCESS;
}
示例6: vlVaBufferSetNumElements
VAStatus
vlVaBufferSetNumElements(VADriverContextP ctx, VABufferID buf_id,
unsigned int num_elements)
{
vlVaBuffer *buf;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
buf = handle_table_get(VL_VA_DRIVER(ctx)->htab, buf_id);
if (!buf)
return VA_STATUS_ERROR_INVALID_BUFFER;
if (buf->derived_surface.resource)
return VA_STATUS_ERROR_INVALID_BUFFER;
buf->data = REALLOC(buf->data, buf->size * buf->num_elements,
buf->size * num_elements);
buf->num_elements = num_elements;
if (!buf->data)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
return VA_STATUS_SUCCESS;
}
示例7: vlVaCreateBuffer
VAStatus
vlVaCreateBuffer(VADriverContextP ctx, VAContextID context, VABufferType type,
unsigned int size, unsigned int num_elements, void *data,
VABufferID *buf_id)
{
vlVaBuffer *buf;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
buf = CALLOC(1, sizeof(vlVaBuffer));
if (!buf)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
buf->type = type;
buf->size = size;
buf->num_elements = num_elements;
buf->data = MALLOC(size * num_elements);
if (!buf->data) {
FREE(buf);
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
if (data)
memcpy(buf->data, data, size * num_elements);
*buf_id = handle_table_add(VL_VA_DRIVER(ctx)->htab, buf);
return VA_STATUS_SUCCESS;
}
示例8: vlVaDestroySurfaces
VAStatus
vlVaDestroySurfaces(VADriverContextP ctx, VASurfaceID *surface_list, int num_surfaces)
{
vlVaDriver *drv;
int i;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
pipe_mutex_lock(drv->mutex);
for (i = 0; i < num_surfaces; ++i) {
vlVaSurface *surf = handle_table_get(drv->htab, surface_list[i]);
if (!surf) {
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_ERROR_INVALID_SURFACE;
}
if (surf->buffer)
surf->buffer->destroy(surf->buffer);
util_dynarray_fini(&surf->subpics);
FREE(surf);
handle_table_remove(drv->htab, surface_list[i]);
}
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_SUCCESS;
}
示例9: vlVaQueryVideoProcPipelineCaps
VAStatus
vlVaQueryVideoProcPipelineCaps(VADriverContextP ctx, VAContextID context,
VABufferID *filters, unsigned int num_filters,
VAProcPipelineCaps *pipeline_cap)
{
unsigned int i = 0;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
if (!pipeline_cap)
return VA_STATUS_ERROR_INVALID_PARAMETER;
if (num_filters && !filters)
return VA_STATUS_ERROR_INVALID_PARAMETER;
pipeline_cap->pipeline_flags = 0;
pipeline_cap->filter_flags = 0;
pipeline_cap->num_forward_references = 0;
pipeline_cap->num_backward_references = 0;
pipeline_cap->num_input_color_standards = 1;
pipeline_cap->input_color_standards = vpp_input_color_standards;
pipeline_cap->num_output_color_standards = 1;
pipeline_cap->output_color_standards = vpp_output_color_standards;
for (i = 0; i < num_filters; i++) {
vlVaBuffer *buf = handle_table_get(VL_VA_DRIVER(ctx)->htab, filters[i]);
if (!buf || buf->type >= VABufferTypeMax)
return VA_STATUS_ERROR_INVALID_BUFFER;
}
return VA_STATUS_SUCCESS;
}
示例10: vlVaUnmapBuffer
VAStatus
vlVaUnmapBuffer(VADriverContextP ctx, VABufferID buf_id)
{
vlVaDriver *drv;
vlVaBuffer *buf;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
if (!drv)
return VA_STATUS_ERROR_INVALID_CONTEXT;
buf = handle_table_get(drv->htab, buf_id);
if (!buf)
return VA_STATUS_ERROR_INVALID_BUFFER;
if (buf->export_refcount > 0)
return VA_STATUS_ERROR_INVALID_BUFFER;
if (buf->derived_surface.resource) {
if (!buf->derived_surface.transfer)
return VA_STATUS_ERROR_INVALID_BUFFER;
pipe_buffer_unmap(drv->pipe, buf->derived_surface.transfer);
buf->derived_surface.transfer = NULL;
}
return VA_STATUS_SUCCESS;
}
示例11: vlVaDestroyContext
VAStatus
vlVaDestroyContext(VADriverContextP ctx, VAContextID context_id)
{
vlVaDriver *drv;
vlVaContext *context;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
context = handle_table_get(drv->htab, context_id);
if (context->decoder) {
if (u_reduce_video_profile(context->decoder->profile) ==
PIPE_VIDEO_FORMAT_MPEG4_AVC) {
FREE(context->desc.h264.pps->sps);
FREE(context->desc.h264.pps);
}
if (u_reduce_video_profile(context->decoder->profile) ==
PIPE_VIDEO_FORMAT_HEVC) {
FREE(context->desc.h265.pps->sps);
FREE(context->desc.h265.pps);
}
context->decoder->destroy(context->decoder);
}
FREE(context);
handle_table_remove(drv->htab, context_id);
return VA_STATUS_SUCCESS;
}
示例12: vlVaBeginPicture
VAStatus
vlVaBeginPicture(VADriverContextP ctx, VAContextID context_id, VASurfaceID render_target)
{
vlVaDriver *drv;
vlVaContext *context;
vlVaSurface *surf;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
if (!drv)
return VA_STATUS_ERROR_INVALID_CONTEXT;
mtx_lock(&drv->mutex);
context = handle_table_get(drv->htab, context_id);
if (!context) {
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_INVALID_CONTEXT;
}
if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_MPEG12) {
context->desc.mpeg12.intra_matrix = NULL;
context->desc.mpeg12.non_intra_matrix = NULL;
}
surf = handle_table_get(drv->htab, render_target);
mtx_unlock(&drv->mutex);
if (!surf || !surf->buffer)
return VA_STATUS_ERROR_INVALID_SURFACE;
context->target_id = render_target;
surf->ctx = context_id;
context->target = surf->buffer;
context->mjpeg.sampling_factor = 0;
if (!context->decoder) {
/* VPP */
if (context->templat.profile == PIPE_VIDEO_PROFILE_UNKNOWN &&
context->target->buffer_format != PIPE_FORMAT_B8G8R8A8_UNORM &&
context->target->buffer_format != PIPE_FORMAT_R8G8B8A8_UNORM &&
context->target->buffer_format != PIPE_FORMAT_B8G8R8X8_UNORM &&
context->target->buffer_format != PIPE_FORMAT_R8G8B8X8_UNORM &&
context->target->buffer_format != PIPE_FORMAT_NV12 &&
context->target->buffer_format != PIPE_FORMAT_P016)
return VA_STATUS_ERROR_UNIMPLEMENTED;
return VA_STATUS_SUCCESS;
}
if (context->decoder->entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE)
context->needs_begin_frame = true;
return VA_STATUS_SUCCESS;
}
示例13: vlVaSyncSurface
VAStatus
vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target)
{
vlVaDriver *drv;
vlVaContext *context;
vlVaSurface *surf;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
if (!drv)
return VA_STATUS_ERROR_INVALID_CONTEXT;
pipe_mutex_lock(drv->mutex);
surf = handle_table_get(drv->htab, render_target);
if (!surf || !surf->buffer) {
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_ERROR_INVALID_SURFACE;
}
if (!surf->feedback) {
// No outstanding operation: nothing to do.
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_SUCCESS;
}
context = handle_table_get(drv->htab, surf->ctx);
if (!context) {
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_ERROR_INVALID_CONTEXT;
}
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
int frame_diff;
if (context->desc.h264enc.frame_num_cnt >= surf->frame_num_cnt)
frame_diff = context->desc.h264enc.frame_num_cnt - surf->frame_num_cnt;
else
frame_diff = 0xFFFFFFFF - surf->frame_num_cnt + 1 + context->desc.h264enc.frame_num_cnt;
if ((frame_diff == 0) &&
(surf->force_flushed == false) &&
(context->desc.h264enc.frame_num_cnt % 2 != 0)) {
context->decoder->flush(context->decoder);
context->first_single_submitted = true;
}
context->decoder->get_feedback(context->decoder, surf->feedback, &(surf->coded_buf->coded_size));
surf->feedback = NULL;
}
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_SUCCESS;
}
示例14: vlVaDestroyImage
VAStatus
vlVaDestroyImage(VADriverContextP ctx, VAImageID image)
{
vlVaDriver *drv;
VAImage *vaimage;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
pipe_mutex_lock(drv->mutex);
vaimage = handle_table_get(drv->htab, image);
if (!vaimage) {
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_ERROR_INVALID_IMAGE;
}
handle_table_remove(VL_VA_DRIVER(ctx)->htab, image);
pipe_mutex_unlock(drv->mutex);
FREE(vaimage);
return vlVaDestroyBuffer(ctx, vaimage->buf);
}
示例15: vlVaMapBuffer
VAStatus
vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff)
{
vlVaDriver *drv;
vlVaBuffer *buf;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
if (!drv)
return VA_STATUS_ERROR_INVALID_CONTEXT;
if (!pbuff)
return VA_STATUS_ERROR_INVALID_PARAMETER;
mtx_lock(&drv->mutex);
buf = handle_table_get(drv->htab, buf_id);
if (!buf || buf->export_refcount > 0) {
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_INVALID_BUFFER;
}
if (buf->derived_surface.resource) {
struct pipe_resource *resource;
struct pipe_box box = {};
resource = buf->derived_surface.resource;
box.width = resource->width0;
box.height = resource->height0;
box.depth = resource->depth0;
*pbuff = drv->pipe->transfer_map(drv->pipe, resource, 0, PIPE_TRANSFER_WRITE,
&box, &buf->derived_surface.transfer);
mtx_unlock(&drv->mutex);
if (!buf->derived_surface.transfer || !*pbuff)
return VA_STATUS_ERROR_INVALID_BUFFER;
if (buf->type == VAEncCodedBufferType) {
((VACodedBufferSegment*)buf->data)->buf = *pbuff;
((VACodedBufferSegment*)buf->data)->size = buf->coded_size;
((VACodedBufferSegment*)buf->data)->next = NULL;
*pbuff = buf->data;
}
} else {
mtx_unlock(&drv->mutex);
*pbuff = buf->data;
}
return VA_STATUS_SUCCESS;
}