struct picture_t *p_next;
};
+/**
+ * This function will increase the picture reference count.
+ * It will not have any effect on picture obtained from vout
+ */
+static inline void picture_Yield( picture_t *p_picture )
+{
+ if( p_picture->pf_release )
+ p_picture->i_refcount++;
+}
+/**
+ * This function will release a picture.
+ * It will not have any effect on picture obtained from vout
+ */
+static inline void picture_Release( picture_t *p_picture )
+{
+ /* FIXME why do we let pf_release handle the i_refcount ? */
+ if( p_picture->pf_release )
+ p_picture->pf_release( p_picture );
+}
+
+/**
+ * This function will copy all picture dynamic properties.
+ */
+static inline void picture_CopyProperties( picture_t *p_dst, const picture_t *p_src )
+{
+ p_dst->date = p_src->date;
+ p_dst->b_force = p_src->b_force;
+
+ p_dst->b_progressive = p_src->b_progressive;
+ p_dst->i_nb_fields = p_src->i_nb_fields;
+ p_dst->b_top_field_first = p_src->b_top_field_first;
+}
+
/**
* Video picture heap, either render (to store pictures used
* by the decoder) or output (to store pictures displayed by the vout plugin)
while( (p_tmp = p_image->p_dec->pf_decode_video( p_image->p_dec, &p_block ))
!= NULL )
{
- if ( p_pic != NULL )
- p_pic->pf_release( p_pic );
+ if( p_pic != NULL )
+ picture_Release( p_pic );
p_pic = p_tmp;
}
if( !p_image->p_filter )
{
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
return NULL;
}
}
p_image->p_filter->fmt_out.video = p_image->p_enc->fmt_in.video;
}
- if( p_pic->pf_release )
- p_pic->i_refcount++;
+ picture_Yield( p_pic );
+
p_tmp_pic =
p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic );
p_image->p_filter->fmt_out.video = *p_fmt_out;
}
- if( p_pic->pf_release )
- p_pic->i_refcount++;
+ picture_Yield( p_pic );
+
p_pif = p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic );
if( p_fmt_in->i_chroma == p_fmt_out->i_chroma &&
p_fmt_in->i_height == p_fmt_out->i_height )
{
/* Duplicate image */
- p_pif->pf_release( p_pif ); /* XXX: Better fix must be possible */
+ picture_Release( p_pif ); /* XXX: Better fix must be possible */
p_pif = p_image->p_filter->pf_vout_buffer_new( p_image->p_filter );
if( p_pif ) vout_CopyPicture( p_image->p_parent, p_pif, p_pic );
}
p_image->p_filter->fmt_out.video = *p_fmt;
}
- if( p_pic->pf_release )
- p_pic->i_refcount++;
+ picture_Yield( p_pic );
+
return p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic );
}
static void video_link_picture( decoder_t *p_dec, picture_t *p_pic )
{
(void)p_dec;
- p_pic->i_refcount++;
+ picture_Yield( p_pic );
}
static void video_unlink_picture( decoder_t *p_dec, picture_t *p_pic )
{
- (void)p_dec; (void)p_pic;
- video_release_buffer( p_pic );
+ (void)p_dec;
+ picture_Release( p_pic );
}
static decoder_t *CreateDecoder( vlc_object_t *p_this, video_format_t *fmt )