/* Copy picture information, set some default values */
p_freepic->i_status = RESERVED_PICTURE;
p_freepic->i_type = MEMORY_PICTURE;
+ p_freepic->b_slow = 0;
p_freepic->i_refcount = 0;
p_freepic->b_force = 0;
return NULL;
}
- CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] );
+ if( p_subpic == NULL ||
+ ( p_vout->render.b_allow_modify_pics && !p_pic->i_refcount ) )
+ {
+ vout_RenderSubPictures( p_vout, p_pic, p_subpic );
+ CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] );
+ }
+ else if( PP_OUTPUTPICTURE[0]->b_slow )
+ {
+ /* The picture buffer is in slow memory. We'll use
+ * the "2 * VOUT_MAX_PICTURES + 1" picture as a temporary
+ * one for subpictures rendering. */
+ picture_t *p_tmp_pic = &p_vout->p_picture[2 * VOUT_MAX_PICTURES];
+ if( p_tmp_pic->i_status == FREE_PICTURE )
+ {
+ vout_AllocatePicture( VLC_OBJECT(p_vout),
+ p_tmp_pic, p_vout->render.i_chroma,
+ p_vout->render.i_width,
+ p_vout->render.i_height,
+ p_vout->render.i_aspect );
+ p_tmp_pic->i_type = MEMORY_PICTURE;
+ p_tmp_pic->i_status = RESERVED_PICTURE;
+ }
+
+ CopyPicture( p_vout, p_pic, p_tmp_pic );
+
+ vout_RenderSubPictures( p_vout, p_tmp_pic, p_subpic );
- vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0], p_subpic );
+ CopyPicture( p_vout, p_tmp_pic, PP_OUTPUTPICTURE[0] );
+ }
+ else
+ {
+ CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] );
+
+ vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0], p_subpic );
+ }
if( PP_OUTPUTPICTURE[0]->pf_unlock )
PP_OUTPUTPICTURE[0]->pf_unlock( p_vout, PP_OUTPUTPICTURE[0] );
* well. This usually means software YUV, or hardware YUV with a
* different chroma. */
- if( p_vout->p_picture[0].pf_lock )
- if( p_vout->p_picture[0].pf_lock( p_vout, &p_vout->p_picture[0] ) )
- return NULL;
+ if( p_subpic != NULL && p_vout->p_picture[0].b_slow )
+ {
+ /* The picture buffer is in slow memory. We'll use
+ * the "2 * VOUT_MAX_PICTURES + 1" picture as a temporary
+ * one for subpictures rendering. */
+ picture_t *p_tmp_pic = &p_vout->p_picture[2 * VOUT_MAX_PICTURES];
+ if( p_tmp_pic->i_status == FREE_PICTURE )
+ {
+ vout_AllocatePicture( VLC_OBJECT(p_vout),
+ p_tmp_pic, p_vout->output.i_chroma,
+ p_vout->output.i_width,
+ p_vout->output.i_height,
+ p_vout->output.i_aspect );
+ p_tmp_pic->i_type = MEMORY_PICTURE;
+ p_tmp_pic->i_status = RESERVED_PICTURE;
+ }
+
+ /* Convert image to the first direct buffer */
+ p_vout->chroma.pf_convert( p_vout, p_pic, p_tmp_pic );
+
+ /* Render subpictures on the first direct buffer */
+ vout_RenderSubPictures( p_vout, p_tmp_pic, p_subpic );
+
+ if( p_vout->p_picture[0].pf_lock )
+ if( p_vout->p_picture[0].pf_lock( p_vout, &p_vout->p_picture[0] ) )
+ return NULL;
+
+ CopyPicture( p_vout, p_tmp_pic, &p_vout->p_picture[0] );
+ }
+ else
+ {
+ if( p_vout->p_picture[0].pf_lock )
+ if( p_vout->p_picture[0].pf_lock( p_vout, &p_vout->p_picture[0] ) )
+ return NULL;
- /* Convert image to the first direct buffer */
- p_vout->chroma.pf_convert( p_vout, p_pic, &p_vout->p_picture[0] );
+ /* Convert image to the first direct buffer */
+ p_vout->chroma.pf_convert( p_vout, p_pic, &p_vout->p_picture[0] );
- /* Render subpictures on the first direct buffer */
- vout_RenderSubPictures( p_vout, &p_vout->p_picture[0], p_subpic );
+ /* Render subpictures on the first direct buffer */
+ vout_RenderSubPictures( p_vout, &p_vout->p_picture[0], p_subpic );
+ }
if( p_vout->p_picture[0].pf_unlock )
p_vout->p_picture[0].pf_unlock( p_vout, &p_vout->p_picture[0] );