forked from marfrit/libva-v4l2-request-fourier
context: Rename object context structure fields for more clarity
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
This commit is contained in:
+11
-10
@@ -73,16 +73,19 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP ctx, VAConfigID config_id,
|
|||||||
return vaStatus;
|
return vaStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_context->context_id = contextID;
|
|
||||||
*context = contextID;
|
|
||||||
obj_context->current_render_target = -1;
|
|
||||||
obj_context->config_id = config_id;
|
obj_context->config_id = config_id;
|
||||||
|
obj_context->render_target = VA_INVALID;
|
||||||
|
obj_context->render_targets = (VASurfaceID *) malloc(num_render_targets * sizeof(VASurfaceID));
|
||||||
|
obj_context->render_targets_count = num_render_targets;
|
||||||
obj_context->picture_width = picture_width;
|
obj_context->picture_width = picture_width;
|
||||||
obj_context->picture_height = picture_height;
|
obj_context->picture_height = picture_height;
|
||||||
obj_context->num_render_targets = num_render_targets;
|
|
||||||
obj_context->render_targets = (VASurfaceID *) malloc(num_render_targets * sizeof(VASurfaceID));
|
|
||||||
obj_context->num_rendered_surfaces = 0;
|
obj_context->num_rendered_surfaces = 0;
|
||||||
|
|
||||||
|
*context = contextID;
|
||||||
|
|
||||||
|
struct v4l2_ctrl_mpeg2_frame_hdr mpeg2_frame_hdr;
|
||||||
|
uint32_t num_rendered_surfaces;
|
||||||
|
|
||||||
if (obj_context->render_targets == NULL)
|
if (obj_context->render_targets == NULL)
|
||||||
{
|
{
|
||||||
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
|
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
|
||||||
@@ -103,11 +106,10 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP ctx, VAConfigID config_id,
|
|||||||
/* Error recovery */
|
/* Error recovery */
|
||||||
if (VA_STATUS_SUCCESS != vaStatus)
|
if (VA_STATUS_SUCCESS != vaStatus)
|
||||||
{
|
{
|
||||||
obj_context->context_id = -1;
|
|
||||||
obj_context->config_id = -1;
|
obj_context->config_id = -1;
|
||||||
free(obj_context->render_targets);
|
free(obj_context->render_targets);
|
||||||
obj_context->render_targets = NULL;
|
obj_context->render_targets = NULL;
|
||||||
obj_context->num_render_targets = 0;
|
obj_context->render_targets_count = 0;
|
||||||
obj_context->flags = 0;
|
obj_context->flags = 0;
|
||||||
object_heap_free(&driver_data->context_heap, (object_base_p) obj_context);
|
object_heap_free(&driver_data->context_heap, (object_base_p) obj_context);
|
||||||
}
|
}
|
||||||
@@ -160,17 +162,16 @@ VAStatus SunxiCedrusDestroyContext(VADriverContextP ctx, VAContextID context)
|
|||||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||||
ioctl(driver_data->mem2mem_fd, VIDIOC_STREAMOFF, &type);
|
ioctl(driver_data->mem2mem_fd, VIDIOC_STREAMOFF, &type);
|
||||||
|
|
||||||
obj_context->context_id = -1;
|
|
||||||
obj_context->config_id = -1;
|
obj_context->config_id = -1;
|
||||||
obj_context->picture_width = 0;
|
obj_context->picture_width = 0;
|
||||||
obj_context->picture_height = 0;
|
obj_context->picture_height = 0;
|
||||||
if (obj_context->render_targets)
|
if (obj_context->render_targets)
|
||||||
free(obj_context->render_targets);
|
free(obj_context->render_targets);
|
||||||
obj_context->render_targets = NULL;
|
obj_context->render_targets = NULL;
|
||||||
obj_context->num_render_targets = 0;
|
obj_context->render_targets_count = 0;
|
||||||
obj_context->flags = 0;
|
obj_context->flags = 0;
|
||||||
|
|
||||||
obj_context->current_render_target = -1;
|
obj_context->render_target = -1;
|
||||||
|
|
||||||
object_heap_free(&driver_data->context_heap, (object_base_p) obj_context);
|
object_heap_free(&driver_data->context_heap, (object_base_p) obj_context);
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -41,17 +41,18 @@
|
|||||||
|
|
||||||
struct object_context {
|
struct object_context {
|
||||||
struct object_base base;
|
struct object_base base;
|
||||||
VAContextID context_id;
|
|
||||||
VAConfigID config_id;
|
VAConfigID config_id;
|
||||||
VASurfaceID current_render_target;
|
VASurfaceID render_target;
|
||||||
|
VASurfaceID *render_targets;
|
||||||
|
int render_targets_count;
|
||||||
|
|
||||||
int picture_width;
|
int picture_width;
|
||||||
int picture_height;
|
int picture_height;
|
||||||
int num_render_targets;
|
|
||||||
int flags;
|
int flags;
|
||||||
VASurfaceID *render_targets;
|
|
||||||
uint32_t num_rendered_surfaces;
|
|
||||||
|
|
||||||
struct v4l2_ctrl_mpeg2_frame_hdr mpeg2_frame_hdr;
|
struct v4l2_ctrl_mpeg2_frame_hdr mpeg2_frame_hdr;
|
||||||
|
uint32_t num_rendered_surfaces;
|
||||||
};
|
};
|
||||||
|
|
||||||
VAStatus SunxiCedrusCreateContext(VADriverContextP ctx, VAConfigID config_id,
|
VAStatus SunxiCedrusCreateContext(VADriverContextP ctx, VAConfigID config_id,
|
||||||
|
|||||||
+4
-4
@@ -75,7 +75,7 @@ VAStatus SunxiCedrusBeginPicture(VADriverContextP ctx, VAContextID context,
|
|||||||
obj_surface->input_buf_index = obj_context->num_rendered_surfaces%INPUT_BUFFERS_NB;
|
obj_surface->input_buf_index = obj_context->num_rendered_surfaces%INPUT_BUFFERS_NB;
|
||||||
obj_context->num_rendered_surfaces ++;
|
obj_context->num_rendered_surfaces ++;
|
||||||
|
|
||||||
obj_context->current_render_target = obj_surface->base.id;
|
obj_context->render_target = obj_surface->base.id;
|
||||||
|
|
||||||
return vaStatus;
|
return vaStatus;
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ VAStatus SunxiCedrusRenderPicture(VADriverContextP ctx, VAContextID context,
|
|||||||
return vaStatus;
|
return vaStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_surface = SURFACE(obj_context->current_render_target);
|
obj_surface = SURFACE(obj_context->render_target);
|
||||||
assert(obj_surface);
|
assert(obj_surface);
|
||||||
|
|
||||||
/* verify that we got valid buffer references */
|
/* verify that we got valid buffer references */
|
||||||
@@ -151,7 +151,7 @@ VAStatus SunxiCedrusEndPicture(VADriverContextP ctx, VAContextID context)
|
|||||||
obj_context = CONTEXT(context);
|
obj_context = CONTEXT(context);
|
||||||
assert(obj_context);
|
assert(obj_context);
|
||||||
|
|
||||||
obj_surface = SURFACE(obj_context->current_render_target);
|
obj_surface = SURFACE(obj_context->render_target);
|
||||||
assert(obj_surface);
|
assert(obj_surface);
|
||||||
|
|
||||||
obj_config = CONFIG(obj_context->config_id);
|
obj_config = CONFIG(obj_context->config_id);
|
||||||
@@ -242,7 +242,7 @@ VAStatus SunxiCedrusEndPicture(VADriverContextP ctx, VAContextID context)
|
|||||||
|
|
||||||
|
|
||||||
/* For now, assume that we are done with rendering right away */
|
/* For now, assume that we are done with rendering right away */
|
||||||
obj_context->current_render_target = -1;
|
obj_context->render_target = -1;
|
||||||
|
|
||||||
return vaStatus;
|
return vaStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user