Commit 2ad9f25d authored by sigmunau's avatar sigmunau
Browse files

include/osd.h, src/video_output/video_text.c:

 * turned vout_OSDMessage into __vout_OSDMessage
 * __vout_OSDMessage now takes printf style parameters
 * added a macro vout_OSDMessage that calls __vout_OSDMessage with the first
   parameter passed through VLC_OBJECT()
parent c5e49dee
......@@ -2,7 +2,7 @@
* osd.h : Constants for use with osd modules
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: osd.h,v 1.6 2003/12/08 17:48:13 yoann Exp $
* $Id: osd.h,v 1.7 2004/02/15 18:22:26 sigmunau Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -47,4 +47,12 @@ static const text_style_t default_text_style = { 22, 0xffffff, VLC_FALSE, VLC_FA
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 * ) );
VLC_EXPORT( void, __vout_OSDMessage, ( vlc_object_t *, char *, ... ) );
/**
* Same as __vlc_OSDMessage() but with automatic casting
*/
#if defined(HAVE_VARIADIC_MACROS)
# define vout_OSDMessage( obj, fmt, args...) __vout_OSDMessage( VLC_OBJECT(obj), fmt, ## args )
#else
# define vout_OSDMessage __vout_OSDMessage
#endif
......@@ -2,7 +2,7 @@
* video_text.c : text manipulation functions
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
* $Id: video_text.c,v 1.50 2004/01/06 12:02:06 zorglub Exp $
* $Id: video_text.c,v 1.51 2004/02/15 18:22:26 sigmunau Exp $
*
* Author: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -90,9 +90,11 @@ void vout_ShowTextAbsolute( vout_thread_t *p_vout, char *psz_string,
* \param p_caller The object that called the function.
* \param psz_string The text to be shown
**/
void vout_OSDMessage( vlc_object_t *p_caller, char *psz_string )
void __vout_OSDMessage( vlc_object_t *p_caller, char *psz_format, ... )
{
vout_thread_t *p_vout;
char *psz_string;
va_list args;
if( !config_GetInt( p_caller, "osd" ) ) return;
......@@ -100,6 +102,8 @@ void vout_OSDMessage( vlc_object_t *p_caller, char *psz_string )
if( p_vout )
{
va_start( args, psz_format );
vasprintf( &psz_string, psz_format, args );
vlc_mutex_lock( &p_vout->change_lock );
if( p_vout->p_last_osd_message )
......@@ -113,6 +117,8 @@ void vout_OSDMessage( vlc_object_t *p_caller, char *psz_string )
vlc_mutex_unlock( &p_vout->change_lock );
vlc_object_release( p_vout );
free( psz_string );
va_end( args );
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment