The last OSD message is now deleted before printing new one.
* osd.h : Constants for use with osd modules
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: osd.h,v 1.5 2003/10/30 22:34:48 hartman Exp $
+ * $Id: osd.h,v 1.6 2003/12/08 17:48:13 yoann Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
};
static const text_style_t default_text_style = { 22, 0xffffff, VLC_FALSE, VLC_FALSE, VLC_FALSE };
-VLC_EXPORT( void, vout_ShowTextRelative, ( vout_thread_t *, char *, text_style_t *, int, int, int, mtime_t ) );
+VLC_EXPORT( subpicture_t *, vout_ShowTextRelative, ( vout_thread_t *, char *, text_style_t *, int, int, int, mtime_t ) );
VLC_EXPORT( void, vout_ShowTextAbsolute, ( vout_thread_t *, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
VLC_EXPORT( void, vout_OSDMessage, ( vlc_object_t *, char * ) );
* video_output.h : video output thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_output.h,v 1.104 2003/12/07 19:09:37 jpsaman Exp $
+ * $Id: video_output.h,v 1.105 2003/12/08 17:48:13 yoann Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
picture_t p_picture[2*VOUT_MAX_PICTURES]; /**< pictures */
subpicture_t p_subpicture[VOUT_MAX_PICTURES]; /**< subpictures */
+ subpicture_t * last_osd_message;
+
/* Statistics */
count_t c_loops;
count_t c_pictures, c_late_pictures;
the text renderer */
module_t * p_text_renderer_module; /**< text renderer module */
/** callback used when a new string needs to be shown on the vout */
- int ( *pf_add_string ) ( vout_thread_t *, char *, text_style_t *, int,
+ subpicture_t * ( *pf_add_string ) ( vout_thread_t *, char *, text_style_t *, int,
int, int, mtime_t, mtime_t );
};
* renderer.c : dummy text rendering functions
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: renderer.c,v 1.3 2003/12/07 19:09:37 jpsaman Exp $
+ * $Id: renderer.c,v 1.4 2003/12/08 17:48:13 yoann Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
#include <vlc/vlc.h>
#include <vlc/vout.h>
-static int AddText ( vout_thread_t *, char *, text_style_t *, int,
+static subpicture_t * AddText ( vout_thread_t *, char *, text_style_t *, int,
int, int, mtime_t, mtime_t );
int E_(OpenRenderer)( vlc_object_t *p_this )
return VLC_SUCCESS;
}
-static int AddText ( vout_thread_t *p_vout, char *psz_string,
+static subpicture_t * AddText ( vout_thread_t *p_vout, char *psz_string,
text_style_t *p_style , int i_flags, int i_x_margin,
int i_y_margin, mtime_t i_start, mtime_t i_stop )
{
* freetype.c : Put text on the video, using freetype2
*****************************************************************************
* Copyright (C) 2002, 2003 VideoLAN
- * $Id: freetype.c,v 1.37 2003/12/07 19:00:33 jpsaman Exp $
+ * $Id: freetype.c,v 1.38 2003/12/08 17:48:13 yoann Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
const subpicture_t * );
static void RenderRV32( vout_thread_t *, picture_t *,
const subpicture_t * );
-static int AddText ( vout_thread_t *, char *, text_style_t *, int,
- int, int, mtime_t, mtime_t );
+static subpicture_t *AddText ( vout_thread_t *, char *, text_style_t *, int,
+ int, int, mtime_t, mtime_t );
static void FreeString( subpicture_t * );
* needed glyphs into memory. It is used as pf_add_string callback in
* the vout method by this module
*/
-static int AddText ( vout_thread_t *p_vout, char *psz_string,
+static subpicture_t *AddText ( vout_thread_t *p_vout, char *psz_string,
text_style_t *p_style, int i_flags, int i_hmargin,
int i_vmargin, mtime_t i_start, mtime_t i_stop )
{
/* Sanity check */
if ( !psz_string || !*psz_string )
{
- return VLC_EGENERIC;
+ return NULL;
}
result.x = 0;
p_subpic = vout_CreateSubPicture( p_vout, MEMORY_SUBPICTURE );
if ( p_subpic == NULL )
{
- return VLC_EGENERIC;
+ return NULL;
}
p_subpic->p_sys = 0;
p_subpic->pf_render = Render;
p_string->i_height = result.y;
p_string->i_width = result.x;
vout_DisplaySubPicture( p_vout, p_subpic );
- return VLC_SUCCESS;
+ return p_subpic;
#undef face
#undef glyph
error:
FreeString( p_subpic );
vout_DestroySubPicture( p_vout, p_subpic );
- return VLC_EGENERIC;
+ return NULL;
}
static void FreeString( subpicture_t *p_subpic )
* video_text.c : text manipulation functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: video_text.c,v 1.46 2003/10/30 22:34:48 hartman Exp $
+ * $Id: video_text.c,v 1.47 2003/12/08 17:48:13 yoann Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
* \param i_vmargin vertical margin in pixels
* \param i_duration Amount of time the text is to be shown.
*/
-void vout_ShowTextRelative( vout_thread_t *p_vout, char *psz_string,
+subpicture_t *vout_ShowTextRelative( vout_thread_t *p_vout, char *psz_string,
text_style_t *p_style, int i_flags,
int i_hmargin, int i_vmargin,
mtime_t i_duration )
{
+ subpicture_t *p_subpic = NULL;
mtime_t i_now = mdate();
+
if ( p_vout->pf_add_string )
{
- p_vout->pf_add_string( p_vout, psz_string, p_style, i_flags, i_hmargin,
- i_vmargin, i_now, i_now + i_duration );
+ p_subpic = p_vout->pf_add_string( p_vout, psz_string, p_style, i_flags,
+ i_hmargin, i_vmargin, i_now, i_now + i_duration );
}
else
{
- msg_Warn( p_vout, "No text renderer found" );
+ msg_Warn( p_vout, "No text renderer found" );
}
+
+ return p_subpic;
}
/**
{
if ( p_vout->pf_add_string )
{
- p_vout->pf_add_string( p_vout, psz_string, p_style, i_flags, i_hmargin,
+ p_vout->pf_add_string( p_vout, psz_string, p_style, i_flags, i_hmargin,
i_vmargin, i_start, i_stop );
}
else
{
- msg_Warn( p_vout, "No text renderer found" );
+ msg_Warn( p_vout, "No text renderer found" );
}
}
if( p_vout )
{
- vout_ShowTextRelative( p_vout, psz_string, NULL,
- OSD_ALIGN_TOP|OSD_ALIGN_RIGHT,
- 30,20,1000000 );
+ if( p_vout->last_osd_message )
+ {
+ vout_DestroySubPicture( p_vout, p_vout->last_osd_message );
+ p_vout->last_osd_message = NULL;
+ }
+ p_vout->last_osd_message = vout_ShowTextRelative( p_vout, psz_string,
+ NULL, OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,1000000 );
vlc_object_release( p_vout );
}
}
* vout_subpictures.c : subpicture management functions
*****************************************************************************
* Copyright (C) 2000 VideoLAN
- * $Id: vout_subpictures.c,v 1.21 2003/07/15 18:12:05 sigmunau Exp $
+ * $Id: vout_subpictures.c,v 1.22 2003/12/08 17:48:13 yoann Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
p_subpic->pf_destroy( p_subpic );
}
+ if( p_subpic == p_vout->last_osd_message )
+ {
+ p_vout->last_osd_message = NULL;
+ }
+
p_subpic->i_status = FREE_SUBPICTURE;
vlc_mutex_unlock( &p_vout->subpicture_lock );