[vlc-devel] commit: Added new picture helpers (picture_Yield, picture_Release, ( Laurent Aimar )
git version control
git at videolan.org
Fri Jul 18 21:21:31 CEST 2008
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Jul 18 20:47:20 2008 +0200| [af37ba18784c712f7b57a2420ab80d4a06984f20]
Added new picture helpers (picture_Yield, picture_Release,
picture_CopyProperties) and use them inside vlc core.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af37ba18784c712f7b57a2420ab80d4a06984f20
---
include/vlc_vout.h | 33 +++++++++++++++++++++++++++++++++
src/misc/image.c | 26 +++++++++++++-------------
2 files changed, 46 insertions(+), 13 deletions(-)
diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index a016575..c4aa5b7 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -116,6 +116,39 @@ struct picture_t
};
/**
+ * 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)
*/
diff --git a/src/misc/image.c b/src/misc/image.c
index 3117ce4..71c4bfc 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -139,8 +139,8 @@ static picture_t *ImageRead( image_handler_t *p_image, block_t *p_block,
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;
}
@@ -188,7 +188,7 @@ static picture_t *ImageRead( image_handler_t *p_image, block_t *p_block,
if( !p_image->p_filter )
{
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
return NULL;
}
}
@@ -316,8 +316,8 @@ static block_t *ImageWrite( image_handler_t *p_image, picture_t *p_pic,
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 );
@@ -446,8 +446,8 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *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 &&
@@ -455,7 +455,7 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
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 );
}
@@ -493,8 +493,8 @@ static picture_t *ImageFilter( image_handler_t *p_image, picture_t *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 );
}
@@ -611,13 +611,13 @@ static void video_del_buffer( decoder_t *p_dec, picture_t *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 )
More information about the vlc-devel
mailing list