struct video_buffer_private
{
+ struct list_head list;
+ struct pipe_video_buffer *video_buffer;
+
struct pipe_sampler_view *sampler_view_planes[VL_NUM_COMPONENTS];
struct pipe_surface *surfaces[VL_MAX_SURFACES];
struct video_buffer_private *priv = private;
unsigned i;
+ list_del(&priv->list);
+
for (i = 0; i < VL_NUM_COMPONENTS; ++i)
pipe_sampler_view_reference(&priv->sampler_view_planes[i], NULL);
priv = CALLOC_STRUCT(video_buffer_private);
+ list_add(&priv->list, &dec->buffer_privates);
+ priv->video_buffer = buf;
+
sv = buf->get_sampler_view_planes(buf);
for (i = 0; i < VL_NUM_COMPONENTS; ++i)
if (sv[i])
return priv;
}
+static void
+free_video_buffer_privates(struct vl_mpeg12_decoder *dec)
+{
+ struct video_buffer_private *priv, *next;
+
+ LIST_FOR_EACH_ENTRY_SAFE(priv, next, &dec->buffer_privates, list) {
+ struct pipe_video_buffer *buf = priv->video_buffer;
+
+ vl_video_buffer_set_associated_data(buf, &dec->base, NULL, NULL);
+ }
+}
+
static bool
init_zscan_buffer(struct vl_mpeg12_decoder *dec, struct vl_mpeg12_buffer *buffer)
{
assert(decoder);
+ free_video_buffer_privates(dec);
+
/* Asserted in softpipe_delete_fs_state() for some reason */
dec->context->bind_vs_state(dec->context, NULL);
dec->context->bind_fs_state(dec->context, NULL);
if (!init_pipe_state(dec))
goto error_pipe_state;
+ list_inithead(&dec->buffer_privates);
+
return &dec->base;
error_pipe_state: