]> git.sesse.net Git - vlc/commitdiff
include/osd.h, src/video_output/video_text.c:
authorSigmund Augdal Helberg <sigmunau@videolan.org>
Sun, 15 Feb 2004 18:22:26 +0000 (18:22 +0000)
committerSigmund Augdal Helberg <sigmunau@videolan.org>
Sun, 15 Feb 2004 18:22:26 +0000 (18:22 +0000)
 * 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()

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

index 7d0bc60063beeefeb6389a75fef6558d7c12ad82..e9d2745269c55dedd68bb9435728af7aa09158d5 100644 (file)
@@ -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
index 5d4f8aec279155469b2427fa9ca220fb6ecf1345..e34cc4c51c582848d0d072aaa6f574828e290c46 100644 (file)
@@ -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 );
     }
 }