]> git.sesse.net Git - vlc/commitdiff
Support for multiple OSD channels :
authorYoann Peronneau <yoann@videolan.org>
Wed, 2 Jun 2004 22:53:26 +0000 (22:53 +0000)
committerYoann Peronneau <yoann@videolan.org>
Wed, 2 Jun 2004 22:53:26 +0000 (22:53 +0000)
* added i_channel and i_content properties to subpicture_t
* p_last_osd_message is no more used

An OSD channel can contain simultaneously an OSD text and an OSD widget.

18 files changed:
include/osd.h
include/video_output.h
include/vlc_video.h
modules/codec/cmml/intf.c
modules/codec/dvbsub.c
modules/codec/ogt/cvd_parse.c
modules/codec/ogt/ogt_parse.c
modules/codec/spudec/parse.c
modules/codec/subsdec.c
modules/control/hotkeys.c
modules/control/lirc.c
modules/gui/macosx/controls.m
modules/gui/macosx/playlist.m
modules/misc/dummy/renderer.c
modules/misc/freetype.c
src/video_output/video_text.c
src/video_output/video_widgets.c
src/video_output/vout_subpictures.c

index 8ad8487ed7e19fe6d673d6beb8300386e35ad89e..97bcdc4bd54d535d5c08c7885750d744bff2093b 100644 (file)
@@ -53,16 +53,16 @@ struct text_style_t
 };
 static const text_style_t default_text_style = { 22, 0xffffff, VLC_FALSE, VLC_FALSE, VLC_FALSE };
 
-VLC_EXPORT( subpicture_t *, vout_ShowTextRelative, ( vout_thread_t *, char *, text_style_t *, int, int, int, mtime_t ) );
-VLC_EXPORT( int, 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( subpicture_t *, vout_ShowTextRelative, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t ) );
+VLC_EXPORT( int, vout_ShowTextAbsolute, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
+VLC_EXPORT( void,  __vout_OSDMessage, ( vlc_object_t *, int, 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 )
+#    define vout_OSDMessage( obj, chan, fmt, args...) __vout_OSDMessage( VLC_OBJECT(obj), chan, fmt, ## args )
 #else
 #    define vout_OSDMessage __vout_OSDMessage
 #endif
-VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int , short ) );
+VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int, int , short ) );
 VLC_EXPORT( void, vout_OSDIcon, ( vlc_object_t *, short ) );
index 924465660968a40014793f4d04b6b9982bdfca80..08bfce59632ad23ef08a704187f6b418874d3c8c 100644 (file)
@@ -126,8 +126,6 @@ struct vout_thread_t
     picture_t           p_picture[2*VOUT_MAX_PICTURES];        /**< pictures */
     subpicture_t        p_subpicture[VOUT_MAX_PICTURES];    /**< subpictures */
 
-    subpicture_t *      p_last_osd_message;
-
     /* Statistics */
     count_t          c_loops;
     count_t          c_pictures, c_late_pictures;
@@ -147,8 +145,9 @@ struct vout_thread_t
                                                            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 */
-    subpicture_t * ( *pf_add_string ) ( vout_thread_t *, char *, text_style_t *, int,
-                             int, int, mtime_t, mtime_t );
+    subpicture_t * ( *pf_add_string ) ( vout_thread_t *, int, char *,
+                                        text_style_t *, int, int, int, mtime_t,
+                                        mtime_t );
 };
 
 #define I_OUTPUTPICTURES p_vout->output.i_pictures
@@ -257,7 +256,7 @@ enum output_query_e
  * \addtogroup subpicture
  * @{
  */
-VLC_EXPORT( subpicture_t *,  vout_CreateSubPicture,   ( vout_thread_t *, int ) );
+VLC_EXPORT( subpicture_t *,  vout_CreateSubPicture,   ( vout_thread_t *, int, int, int ) );
 VLC_EXPORT( void,            vout_DestroySubPicture,  ( vout_thread_t *, subpicture_t * ) );
 VLC_EXPORT( void,            vout_DisplaySubPicture,  ( vout_thread_t *, subpicture_t * ) );
 
index ef1ef3f286d268b68a9ec4d691d929982387cdb0..bbbe2594610e8eb8fe28807755ff123525b283b7 100644 (file)
@@ -4,7 +4,7 @@
  * includes all common video types and constants.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: vlc_video.h,v 1.9 2004/01/25 18:17:08 zorglub Exp $
+ * $Id$
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -193,6 +193,12 @@ struct picture_heap_t
  */
 struct subpicture_t
 {
+    /** \name Channel and content type */
+    /**@{*/
+    int             i_channel;                      /**< subpicture channel */
+    int             i_content;                            /**< content type */
+    /**@}*/
+
     /** \name Type and flags
        Should NOT be modified except by the vout thread */
     /**@{*/
@@ -240,6 +246,19 @@ struct subpicture_t
 #define RESERVED_SUBPICTURE    1                   /* allocated and reserved */
 #define READY_SUBPICTURE       2                        /* ready for display */
 
+/* Subpicture channel */
+#define SUBT1_CHAN             1
+#define SUBT2_CHAN             2
+#define BEGIN_EXCLUSIVE_CHAN   3           /* exclusive subpic-channels list */
+#define POSITION_CHAN          3
+#define VOLUME_CHAN            4
+#define SOLO_CHAN              5
+#define END_EXCLUSIVE_CHAN     5                               /*end of list */
+
+/* Subpicture content type */
+#define TEXT_CONTENT           0
+#define GRAPH_CONTENT          1             /* used for OSD icon, slider... */
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
index 62cc01ae101c41a686d505df951eaa74a3cf8d4f..511b9b33b7bfc2d81ab28c436c80f8b5e70ad3a4 100644 (file)
@@ -843,8 +843,8 @@ static int DisplayAnchor( intf_thread_t *p_intf,
         /* TODO: p_subpicture doesn't have the proper i_x and i_y
          * coordinates.  Need to look at the subpicture display system to
          * work out why. */
-        if ( vout_ShowTextAbsolute( p_vout,
-                psz_anchor_description, p_style, OSD_ALIGN_BOTTOM, 
+        if ( vout_ShowTextAbsolute( p_vout, SOLO_CHAN,
+                psz_anchor_description, p_style, OSD_ALIGN_BOTTOM,
                 i_margin_h, i_margin_v, i_now, 0 ) == VLC_SUCCESS )
         {
             /* Displayed successfully */
index 518fdee9a0d31ac5f01bf7a4199494313843ac20..89648b50c16b254da44e6c3d240dba798daa3bc8 100644 (file)
@@ -1258,7 +1258,8 @@ static void render( dvbsub_all_t *dvbsub, vout_thread_t *p_vout )
 
             /* Allocate the subpicture internal data. */
             dvbsub->p_spu[j] =
-                vout_CreateSubPicture( p_vout, MEMORY_SUBPICTURE );
+                vout_CreateSubPicture( p_vout, SUBT1_CHAN, TEXT_CONTENT,
+                                       MEMORY_SUBPICTURE );
             if( dvbsub->p_spu[j] == NULL )
             {
                 msg_Err(p_vout, "Unable to allocate memory, skipping");
index 6d70078fea908e8d82f05bac32c070458cb1eb44..79a4ed063e847dbfdbfd151d716615bb9f435fac 100644 (file)
@@ -2,7 +2,7 @@
  * parse.c: Philips OGT (SVCD subtitle) packet parser
  *****************************************************************************
  * Copyright (C) 2003, 2004 VideoLAN
- * $Id: cvd_parse.c,v 1.14 2004/01/22 04:46:19 rocky Exp $
+ * $Id$
  *
  * Authors: Rocky Bernstein 
  *   based on code from: 
@@ -292,7 +292,8 @@ E_(ParsePacket)( decoder_t *p_dec)
     dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , "");
 
     /* Allocate the subpicture internal data. */
-    p_spu = vout_CreateSubPicture( p_sys->p_vout, MEMORY_SUBPICTURE );
+    p_spu = vout_CreateSubPicture( p_sys->p_vout, SUBT1_CHAN, TEXT_CONTENT,
+                                   MEMORY_SUBPICTURE );
     if( p_spu == NULL )
     {
         return;
index e1455bc07e4ca896288e5d23735543069db8299c..09dfea8cb63987ee35c7197103bdabb223018467 100644 (file)
@@ -2,7 +2,7 @@
  * Philips OGT (SVCD subtitle) packet parser
  *****************************************************************************
  * Copyright (C) 2003, 2004 VideoLAN
- * $Id: ogt_parse.c,v 1.12 2004/01/22 04:46:19 rocky Exp $
+ * $Id$
  *
  * Author: Rocky Bernstein 
  *   based on code from: 
@@ -165,7 +165,8 @@ E_(ParsePacket)( decoder_t *p_dec)
     dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , "");
     
     /* Allocate the subpicture internal data. */
-    p_spu = vout_CreateSubPicture( p_sys->p_vout, MEMORY_SUBPICTURE );
+    p_spu = vout_CreateSubPicture( p_sys->p_vout, SUBT1_CHAN, TEXT_CONTENT,
+                                   MEMORY_SUBPICTURE );
     if( p_spu == NULL )
     {
         return;
index 44b3643b45032e0c138f89e0f4620b3eb0557a95..bbad591d7b32c1fa0ca63f989a1c4bc84b051d55 100644 (file)
@@ -2,7 +2,7 @@
  * parse.c: SPU parser
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: parse.c,v 1.17 2004/01/27 22:51:39 hartman Exp $
+ * $Id$
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -72,7 +72,8 @@ void E_(ParsePacket)( decoder_t *p_dec)
     subpicture_t  *p_spu;
 
     /* Allocate the subpicture internal data. */
-    p_spu = vout_CreateSubPicture( p_sys->p_vout, MEMORY_SUBPICTURE );
+    p_spu = vout_CreateSubPicture( p_sys->p_vout, SUBT1_CHAN, TEXT_CONTENT,
+                                   MEMORY_SUBPICTURE );
     if( p_spu == NULL )
     {
         return;
index ef1fba48d0064c32f82334ded8a051a82fd3e63b..93547c46990464820bcf8b5cf860116435edc8c6 100644 (file)
@@ -371,7 +371,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block,
         }
     }
     StripTags( psz_subtitle );
-    vout_ShowTextAbsolute( p_vout, psz_subtitle, NULL, 
+    vout_ShowTextAbsolute( p_vout, SUBT1_CHAN, psz_subtitle, NULL,
         OSD_ALIGN_BOTTOM | p_sys->i_align, i_align_h,
         i_align_v, p_block->i_pts,
         p_block->i_length ? p_block->i_pts + p_block->i_length : 0 );
index e29f96afb32fad690b4672786b67f1b5a1ef382f..a7bdc6c7a54289fcb0ea019caf4a5e61001228c5 100755 (executable)
@@ -232,7 +232,7 @@ static void Run( intf_thread_t *p_intf )
         if( i_action == ACTIONID_QUIT )
         {
             p_intf->p_vlc->b_die = VLC_TRUE;
-            vout_OSDMessage( p_intf, _( "Quit" ) );
+            vout_OSDMessage( p_intf, SOLO_CHAN, _( "Quit" ) );
             continue;
         }
         else if( i_action == ACTIONID_VOL_UP )
@@ -243,12 +243,12 @@ static void Run( intf_thread_t *p_intf )
             {
                 if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                 {
-                    vout_OSDSlider( VLC_OBJECT( p_intf ),
+                    vout_OSDSlider( VLC_OBJECT( p_intf ), VOLUME_CHAN,
                         i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
                 }
                 else
                 {
-                    vout_OSDMessage( p_intf, "Vol %d%%",
+                    vout_OSDMessage( p_intf, VOLUME_CHAN, "Vol %d%%",
                                      2*i_newvol*100/AOUT_VOLUME_MAX );
                 }
             }
@@ -261,12 +261,12 @@ static void Run( intf_thread_t *p_intf )
             {
                 if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                 {
-                    vout_OSDSlider( VLC_OBJECT( p_intf ),
+                    vout_OSDSlider( VLC_OBJECT( p_intf ), VOLUME_CHAN,
                         i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
                 }
                 else
                 {
-                    vout_OSDMessage( p_intf, "Vol %d%%",
+                    vout_OSDMessage( p_intf, VOLUME_CHAN, "Vol %d%%",
                                      2*i_newvol*100/AOUT_VOLUME_MAX );
                 }
             }
@@ -280,19 +280,19 @@ static void Run( intf_thread_t *p_intf )
             {
                 if( i_newvol == 0 )
                 {
-                    vout_OSDMessage( p_intf, _( "Mute" ) );
+                    vout_OSDMessage( p_intf, SOLO_CHAN, _( "Mute" ) );
                     vout_OSDIcon( VLC_OBJECT( p_intf ), OSD_MUTE_ICON );
                 }
                 else
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
-                        vout_OSDSlider( VLC_OBJECT( p_intf ),
+                        vout_OSDSlider( VLC_OBJECT( p_intf ), VOLUME_CHAN,
                             i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
                     }
                     else
                     {
-                        vout_OSDMessage( p_intf, "Vol %d%%",
+                        vout_OSDMessage( p_intf, VOLUME_CHAN, "Vol %d%%",
                                          i_newvol * 100 / AOUT_VOLUME_MAX );
                     }
                 }
@@ -307,7 +307,8 @@ static void Run( intf_thread_t *p_intf )
             {
                 i_delay--;
                 input_Control( p_input, INPUT_SET_SUBDELAY, i_delay );
-                vout_OSDMessage( p_intf, "Subtitle delay %i ms", i_delay*100);
+                vout_OSDMessage( p_intf, SOLO_CHAN, "Subtitle delay %i ms",
+                                 i_delay*100);
             }
         }
         else if( i_action == ACTIONID_SUBDELAY_UP )
@@ -318,7 +319,8 @@ static void Run( intf_thread_t *p_intf )
             {
                 i_delay++;
                 input_Control( p_input, INPUT_SET_SUBDELAY, i_delay );
-                vout_OSDMessage( p_intf, "Subtitle delay %i ms", i_delay*100);
+                vout_OSDMessage( p_intf, SOLO_CHAN, "Subtitle delay %i ms", 
+                                 i_delay*100);
             }
         }
         else if( i_action == ACTIONID_FULLSCREEN && p_vout )
@@ -367,7 +369,7 @@ static void Run( intf_thread_t *p_intf )
 
             if( i_action == ACTIONID_PAUSE )
             {
-                vout_OSDMessage( p_intf, _( "Pause" ) );
+                vout_OSDMessage( p_intf, SOLO_CHAN, _( "Pause" ) );
                 val.i_int = PAUSE_S;
                 var_Set( p_input, "state", val );
             }
@@ -377,12 +379,13 @@ static void Run( intf_thread_t *p_intf )
                 var_Set( p_input, "time-offset", val );
                 if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                 {
-                    vout_OSDSlider( VLC_OBJECT( p_intf ),
+                    vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                     GetPosition( p_intf ), OSD_HOR_SLIDER );
                 }
                 else
                 {
-                    vout_OSDMessage( p_intf, _( "Jump -10 seconds" ) );
+                    vout_OSDMessage( p_intf, SOLO_CHAN,
+                                     _( "Jump -10 seconds" ) );
                 }
             }
             else if( i_action == ACTIONID_JUMP_FORWARD_10SEC && b_seekable )
@@ -393,12 +396,13 @@ static void Run( intf_thread_t *p_intf )
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
-                        vout_OSDSlider( VLC_OBJECT( p_intf ),
+                        vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                         GetPosition( p_intf ), OSD_HOR_SLIDER );
                     }
                     else
                     {
-                        vout_OSDMessage( p_intf, _( "Jump +10 seconds" ) );
+                        vout_OSDMessage( p_intf, POSITION_CHAN,
+                                         _( "Jump +10 seconds" ) );
                     }
                 }
             }
@@ -410,12 +414,13 @@ static void Run( intf_thread_t *p_intf )
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
-                        vout_OSDSlider( VLC_OBJECT( p_intf ),
+                        vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                         GetPosition( p_intf ), OSD_HOR_SLIDER );
                     }
                     else
                     {
-                        vout_OSDMessage( p_intf, _( "Jump -1 minute" ) );
+                        vout_OSDMessage( p_intf, SOLO_CHAN,
+                                         _( "Jump -1 minute" ) );
                     }
                 }
             }
@@ -427,12 +432,13 @@ static void Run( intf_thread_t *p_intf )
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
-                        vout_OSDSlider( VLC_OBJECT( p_intf ),
+                        vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                         GetPosition( p_intf ), OSD_HOR_SLIDER );
                     }
                     else
                     {
-                        vout_OSDMessage( p_intf, _( "Jump +1 minute" ) );
+                        vout_OSDMessage( p_intf, SOLO_CHAN,
+                                         _( "Jump +1 minute" ) );
                     }
                 }
             }
@@ -444,12 +450,13 @@ static void Run( intf_thread_t *p_intf )
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
-                        vout_OSDSlider( VLC_OBJECT( p_intf ),
+                        vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                         GetPosition( p_intf ), OSD_HOR_SLIDER );
                     }
                     else
                     {
-                        vout_OSDMessage( p_intf, _( "Jump -5 minutes" ) );
+                        vout_OSDMessage( p_intf, SOLO_CHAN,
+                                         _( "Jump -5 minutes" ) );
                     }
                 }
             }
@@ -461,12 +468,13 @@ static void Run( intf_thread_t *p_intf )
                 {
                     if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
                     {
-                        vout_OSDSlider( VLC_OBJECT( p_intf ),
+                        vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
                                         GetPosition( p_intf ), OSD_HOR_SLIDER );
                     }
                     else
                     {
-                        vout_OSDMessage( p_intf, _( "Jump +5 minutes" ) );
+                        vout_OSDMessage( p_intf, SOLO_CHAN,
+                                         _( "Jump +5 minutes" ) );
                     }
                 }
             }
@@ -525,12 +533,12 @@ static void Run( intf_thread_t *p_intf )
                 if( time.i_time > 0 )
                 {
                     secstotimestr( psz_duration, time.i_time / 1000000 );
-                    vout_OSDMessage( p_input, "%s / %s",
+                    vout_OSDMessage( p_input, POSITION_CHAN, "%s / %s",
                                      psz_time, psz_duration );
                 }
                 else if( i_seconds > 0 )
                 {
-                    vout_OSDMessage( p_input, psz_time );
+                    vout_OSDMessage( p_input, POSITION_CHAN, psz_time );
                 }
             }
             else if( i_action >= ACTIONID_PLAY_BOOKMARK1 &&
index 7605510cb63ba7f08bee77582dbf37424921119a..75d53c7467471c88c919d2b83e7e24c81f3a8a17 100644 (file)
@@ -189,21 +189,21 @@ static void Run( intf_thread_t *p_intf )
             if( !strcmp( c, "QUIT" ) )
             {
                 p_intf->p_vlc->b_die = VLC_TRUE;
-                vout_OSDMessage( p_intf, _("Quit" ) );
+                vout_OSDMessage( p_intf, SOLO_CHAN, _("Quit" ) );
                 continue;
             }
             else if( !strcmp( c, "VOL_UP" ) )
             {
                 audio_volume_t i_newvol;
                 aout_VolumeUp( p_intf, 1, &i_newvol );
-                vout_OSDMessage( p_intf, _("Vol %%%d"),
+                vout_OSDMessage( p_intf, SOLO_CHAN, _("Vol %%%d"),
                                  i_newvol * 100 / AOUT_VOLUME_MAX );
             }
             else if( !strcmp( c, "VOL_DOWN" ) )
             {
                 audio_volume_t i_newvol;
                 aout_VolumeDown( p_intf, 1, &i_newvol );
-                vout_OSDMessage( p_intf, _("Vol %%%d"),
+                vout_OSDMessage( p_intf, SOLO_CHAN, _("Vol %%%d"),
                                  i_newvol * 100 / AOUT_VOLUME_MAX );
             }
             else if( !strcmp( c, "MUTE" ) )
@@ -212,11 +212,11 @@ static void Run( intf_thread_t *p_intf )
                 aout_VolumeMute( p_intf, &i_newvol );
                 if( i_newvol == 0 )
                 {
-                    vout_OSDMessage( p_intf, _( "Mute" ) );
+                    vout_OSDMessage( p_intf, SOLO_CHAN, _( "Mute" ) );
                 }
                 else
                 {
-                    vout_OSDMessage( p_intf, _("Vol %d%%"),
+                    vout_OSDMessage( p_intf, SOLO_CHAN, _("Vol %d%%"),
                                      i_newvol * 100 / AOUT_VOLUME_MAX );
                 }
             }
@@ -305,7 +305,8 @@ static void Run( intf_thread_t *p_intf )
                 }
                 if( p_input && val.i_int != PAUSE_S )
                 {
-                    vout_OSDMessage( VLC_OBJECT(p_intf), _( "Pause" ) );
+                    vout_OSDMessage( VLC_OBJECT(p_intf), SOLO_CHAN,
+                                     _( "Pause" ) );
                     val.i_int = PAUSE_S;
                     var_Set( p_input, "state", val );
                 }
@@ -319,7 +320,7 @@ static void Run( intf_thread_t *p_intf )
                         if( p_playlist->i_size )
                         {
                             vlc_mutex_unlock( &p_playlist->object_lock );
-                            vout_OSDMessage( p_intf, _( "Play" ) );
+                            vout_OSDMessage( p_intf, SOLO_CHAN, _( "Play" ) );
                             playlist_Play( p_playlist );
                             vlc_object_release( p_playlist );
                         }
@@ -366,7 +367,8 @@ static void Run( intf_thread_t *p_intf )
                                  list.p_list->p_values[i+1] );
                         i++;
                     }
-                    vout_OSDMessage( VLC_OBJECT(p_input), _("Audio track: %s"),
+                    vout_OSDMessage( VLC_OBJECT(p_input), SOLO_CHAN,
+                                     _("Audio track: %s"),
                                      list2.p_list->p_values[i].psz_string );
                 }
                 else if( !strcmp( c, "SUBTITLE_TRACK" ) )
@@ -401,12 +403,14 @@ static void Run( intf_thread_t *p_intf )
                         var_Set( p_input, "spu-es", list.p_list->p_values[i+1] );
                         i = i + 1;
                     }
-                    vout_OSDMessage( VLC_OBJECT(p_input), _("Subtitle track: %s"), list2.p_list->p_values[i].psz_string );
+                    vout_OSDMessage( VLC_OBJECT(p_input), SOLO_CHAN,
+                                     _("Subtitle track: %s"),
+                                     list2.p_list->p_values[i].psz_string );
                 }
                 else if( !strcmp( c, "PAUSE" ) )
                 {
                     vlc_value_t val;
-                    vout_OSDMessage( p_intf, _( "Pause" ) );
+                    vout_OSDMessage( p_intf, SOLO_CHAN, _( "Pause" ) );
                     val.i_int = PAUSE_S;
                     var_Set( p_input, "state", val );
                 }
index def26bf34e2d4bb12de14b3acc19f381e0eb99d7..f3e26d672f12afb16b486ac593548d39649224b5 100644 (file)
@@ -56,7 +56,7 @@
     }
     if( p_input && val.i_int != PAUSE_S )
     {
-        vout_OSDMessage( p_intf, _( "Pause" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Pause" ) );
         val.i_int = PAUSE_S;
         var_Set( p_input, "state", val );
     }
@@ -70,7 +70,7 @@
             if( p_playlist->i_size )
             {
                 vlc_mutex_unlock( &p_playlist->object_lock );
-                vout_OSDMessage( p_intf, _( "Play" ) );
+                vout_OSDMessage( p_intf, SOLO_CHAN, _( "Play" ) );
                 playlist_Play( p_playlist );
                 vlc_object_release( p_playlist );
             }
@@ -92,7 +92,7 @@
                                                        FIND_ANYWHERE );
     if( p_playlist != NULL )
     {
-        vout_OSDMessage( p_intf, _( "Stop" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Stop" ) );
         playlist_Stop( p_playlist );
         vlc_object_release( p_playlist );
     }
         vlc_value_t val; val.b_bool = VLC_TRUE;
 
         var_Set( p_input, "rate-faster", val );
-        vout_OSDMessage( p_intf, _( "Faster" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Faster" ) );
         vlc_object_release( p_input );
     }
 }
         vlc_value_t val; val.b_bool = VLC_TRUE;
 
         var_Set( p_input, "rate-slower", val );
-        vout_OSDMessage( p_intf, _( "Slower" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Slower" ) );
         vlc_object_release( p_input );
     }
 }
     {
         playlist_Prev( p_playlist );
         vlc_object_release( p_playlist );
-        vout_OSDMessage( p_intf, _( "Previous" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Previous" ) );
     }
 }
 
     {
         playlist_Next( p_playlist );
         vlc_object_release( p_playlist );
-        vout_OSDMessage( p_intf, _( "Next" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Next" ) );
     }
 }
 
     var_Set( p_playlist, "random", val );
     if( val.b_bool )
     {
-        vout_OSDMessage( p_intf, _( "Random On" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Random On" ) );
     }
     else
     {
-        vout_OSDMessage( p_intf, _( "Random Off" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Random Off" ) );
     }    
 
     p_intf->p_sys->b_playlist_update = VLC_TRUE;
     var_Set( p_playlist, "repeat", val );
     if( val.b_bool )
     {
-        vout_OSDMessage( p_intf, _( "Repeat All" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat All" ) );
     }
     else
     {
-        vout_OSDMessage( p_intf, _( "Repeat Off" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat Off" ) );
     }
 
     p_intf->p_sys->b_playlist_update = VLC_TRUE;    
     var_Set( p_playlist, "loop", val );
     if( val.b_bool )
     {
-        vout_OSDMessage( p_intf, _( "Repeat One" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat One" ) );
     }
     else
     {
-        vout_OSDMessage( p_intf, _( "Repeat Off" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat Off" ) );
     }    
 
     p_intf->p_sys->b_playlist_update = VLC_TRUE;
         vlc_value_t time;
         time.i_time = 10 * 1000000;
         var_Set( p_input, "time-offset", time );
-        vout_OSDMessage( p_intf, _( "Jump +10 Seconds" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Jump +10 Seconds" ) );
         vlc_object_release( p_input );
     }
 }
         vlc_value_t time;
         time.i_time = -10 * 1000000;
         var_Set( p_input, "time-offset", time );
-        vout_OSDMessage( p_intf, _( "Jump -10 Seconds" ) );
+        vout_OSDMessage( p_intf, SOLO_CHAN, _( "Jump -10 Seconds" ) );
         vlc_object_release( p_input );
     }
 }
 
     [o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
 
-    vout_OSDMessage( p_intf, "Vol %d%%", i_volume*100/AOUT_VOLUME_MAX );
+    vout_OSDMessage( p_intf, SOLO_CHAN, "Vol %d%%", 
+                    i_volume*100/AOUT_VOLUME_MAX );
 }
 
 - (IBAction)windowAction:(id)sender
index 3799073f2bc539ece850cc7909ea3eca17c4b280..c9061139a2dc890efd70d60c937b741903afa27d 100644 (file)
@@ -545,7 +545,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
              var_Set( p_playlist, "loop", val1 );
              val1.b_bool = 1;
              var_Set( p_playlist, "repeat", val1 );
-             vout_OSDMessage( p_intf, _( "Repeat One" ) );
+             vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat One" ) );
         break;
 
         case 2:
@@ -553,7 +553,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
              var_Set( p_playlist, "repeat", val1 );
              val1.b_bool = 1;
              var_Set( p_playlist, "loop", val1 );
-             vout_OSDMessage( p_intf, _( "Repeat All" ) );
+             vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat All" ) );
         break;
 
         default:
@@ -564,7 +564,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
                   val1.b_bool = 0;
                   var_Set( p_playlist, "repeat", val1 );
                   var_Set( p_playlist, "loop", val1 );
-                  vout_OSDMessage( p_intf, _( "Repeat Off" ) );
+                  vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat Off" ) );
              }
          break;
      }
index e0178bed3d2ccb7c1d25946616f2d67cc09df31f..16a141adae2b2e28c5eb23c9e05286afb0a1c8cf 100644 (file)
@@ -2,7 +2,7 @@
  * renderer.c : dummy text rendering functions
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: renderer.c,v 1.4 2003/12/08 17:48:13 yoann Exp $
+ * $Id$
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
@@ -24,8 +24,8 @@
 #include <vlc/vlc.h>
 #include <vlc/vout.h>
 
-static subpicture_t * AddText ( vout_thread_t *, char *, text_style_t *, int,
-                        int, int, mtime_t, mtime_t );
+static subpicture_t * AddText( vout_thread_t *, int, char *, text_style_t *,
+                        int, int, int, mtime_t, mtime_t );
 
 int E_(OpenRenderer)( vlc_object_t *p_this )
 {
@@ -34,9 +34,10 @@ int E_(OpenRenderer)( vlc_object_t *p_this )
     return VLC_SUCCESS;
 }
 
-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 )
+static subpicture_t * AddText( vout_thread_t *p_vout, int i_channel,
+                        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 )
 {
     return VLC_SUCCESS;
 }
index 607ec4e0af0660c6ca0763aabf879836cb94630a..7be8d7a49df7dbefb2a3c159914572b946ec8fae 100644 (file)
@@ -77,8 +77,8 @@ static void RenderYUY2( vout_thread_t *, picture_t *,
                         const subpicture_t * );
 static void RenderRV32( vout_thread_t *, picture_t *,
                         const subpicture_t * );
-static subpicture_t *AddText ( vout_thread_t *, char *, text_style_t *, int,
-                               int, int, mtime_t, mtime_t );
+static subpicture_t *AddText ( vout_thread_t *, int, char *, text_style_t *,
+                               int, int, int, mtime_t, mtime_t );
 
 static void FreeString( subpicture_t * );
 
@@ -667,9 +667,10 @@ static void RenderRV32( vout_thread_t *p_vout, picture_t *p_pic,
  * needed glyphs into memory. It is used as pf_add_string callback in
  * the vout method by this module
  */
-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 )
+static subpicture_t *AddText ( vout_thread_t *p_vout, int i_channel,
+                     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 )
 {
     subpicture_sys_t *p_string;
     int i, i_pen_y, i_pen_x, i_error, i_glyph_index, i_previous;
@@ -705,7 +706,8 @@ static subpicture_t *AddText ( vout_thread_t *p_vout, char *psz_string,
     p_subpic = 0;
 
     /* Create and initialize a subpicture */
-    p_subpic = vout_CreateSubPicture( p_vout, MEMORY_SUBPICTURE );
+    p_subpic = vout_CreateSubPicture( p_vout, i_channel, TEXT_CONTENT,
+                                      MEMORY_SUBPICTURE );
     if ( p_subpic == NULL )
     {
         return NULL;
index 95443c6a39c7345258f2706587293dab6b0ea2e6..104caec69b0723ac213d0e4ae55defc69ad3b226 100644 (file)
@@ -26,6 +26,7 @@
 /**
  * \brief Show text on the video for some time
  * \param p_vout pointer to the vout the text is to be showed on
+ * \param i_channel Subpicture channel
  * \param psz_string The text to be shown
  * \param p_style Pointer to a struct with text style info
  * \param i_flags flags for alignment and such
@@ -33,9 +34,9 @@
  * \param i_vmargin vertical margin in pixels
  * \param i_duration Amount of time the text is to be shown.
  */
-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,
+subpicture_t *vout_ShowTextRelative( vout_thread_t *p_vout, int i_channel,
+                              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;
@@ -43,8 +44,8 @@ subpicture_t *vout_ShowTextRelative( vout_thread_t *p_vout, char *psz_string,
 
     if ( p_vout->pf_add_string )
     {
-        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 );
+        p_subpic = p_vout->pf_add_string( p_vout, i_channel, psz_string,
+           p_style, i_flags, i_hmargin, i_vmargin, i_now, i_now + i_duration );
     }
     else
     {
@@ -57,6 +58,7 @@ subpicture_t *vout_ShowTextRelative( vout_thread_t *p_vout, char *psz_string,
 /**
  * \brief Show text on the video from a given start date to a given end date
  * \param p_vout pointer to the vout the text is to be showed on
+ * \param i_channel Subpicture channel
  * \param psz_string The text to be shown
  * \param p_style Pointer to a struct with text style info
  * \param i_flags flags for alignment and such
@@ -67,14 +69,14 @@ subpicture_t *vout_ShowTextRelative( vout_thread_t *p_vout, char *psz_string,
  *               if this is 0 the string will be shown untill the next string
  *               is about to be shown
  */
-int vout_ShowTextAbsolute( 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 )
+int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
+                           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 )
 {
     if ( p_vout->pf_add_string )
     {
-        p_vout->pf_add_string( p_vout, psz_string, p_style, i_flags,
+        p_vout->pf_add_string( p_vout, i_channel, psz_string, p_style, i_flags,
                                i_hmargin, i_vmargin, i_start, i_stop );
         return VLC_SUCCESS;
     }
@@ -90,9 +92,11 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, char *psz_string,
  * \brief Write an informative message at the default location,
  *        for the default duration and only if the OSD option is enabled.
  * \param p_caller The object that called the function.
+ * \param i_channel Subpicture channel
  * \param psz_format printf style formatting
  **/
-void __vout_OSDMessage( vlc_object_t *p_caller, char *psz_format, ... )
+void __vout_OSDMessage( vlc_object_t *p_caller, int i_channel,
+                        char *psz_format, ... )
 {
     vout_thread_t *p_vout;
     char *psz_string;
@@ -106,17 +110,9 @@ void __vout_OSDMessage( vlc_object_t *p_caller, char *psz_format, ... )
     {
         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 )
-        {
-            vout_DestroySubPicture( p_vout, p_vout->p_last_osd_message );
-        }
-
-        p_vout->p_last_osd_message = vout_ShowTextRelative( p_vout, psz_string,
-                        NULL, OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,1000000 );
-
-        vlc_mutex_unlock( &p_vout->change_lock );
+        vout_ShowTextRelative( p_vout, i_channel, psz_string, NULL,
+                               OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,1000000 );
 
         vlc_object_release( p_vout );
         free( psz_string );
index 44f6475011e5792e46a179ff6f88504a0c37a99c..674f4f92fd9677452a07493f2d338dd2f3eab203 100644 (file)
@@ -45,7 +45,7 @@ static void RenderYUY2( vout_thread_t *, picture_t *, const subpicture_t *,
                         int );
 static void RenderRV32( vout_thread_t *, picture_t *, const subpicture_t *,
                         int );
-static subpicture_t *vout_CreateWidget( vout_thread_t * );
+static subpicture_t *vout_CreateWidget( vout_thread_t *, int );
 static void FreeWidget( subpicture_t * );
 
 /**
@@ -162,9 +162,9 @@ static void DrawTriangle( vout_thread_t *p_vout, subpicture_t *p_subpic,
 }
 
 /*****************************************************************************
- * Render: place string in picture
+ * Render: place widget in picture
  *****************************************************************************
- * This function merges the previously rendered freetype glyphs into a picture
+ * This function merges the previously drawn widget into a picture
  *****************************************************************************/
 static void Render( vout_thread_t *p_vout, picture_t *p_pic,
                     const subpicture_t *p_subpic )
@@ -372,7 +372,7 @@ static void RenderRV32( vout_thread_t *p_vout, picture_t *p_pic,
 /*****************************************************************************
  * Creates and initializes an OSD widget.
  *****************************************************************************/
-subpicture_t *vout_CreateWidget( vout_thread_t *p_vout )
+subpicture_t *vout_CreateWidget( vout_thread_t *p_vout, int i_channel )
 {
     subpicture_t *p_subpic;
     subpicture_sys_t *p_widget;
@@ -382,7 +382,8 @@ subpicture_t *vout_CreateWidget( vout_thread_t *p_vout )
     p_widget = 0;
 
     /* Create and initialize a subpicture */
-    p_subpic = vout_CreateSubPicture( p_vout, MEMORY_SUBPICTURE );
+    p_subpic = vout_CreateSubPicture( p_vout, i_channel, GRAPH_CONTENT,
+                                      MEMORY_SUBPICTURE );
     if( p_subpic == NULL )
     {
         return NULL;
@@ -409,7 +410,8 @@ subpicture_t *vout_CreateWidget( vout_thread_t *p_vout )
  * Displays an OSD slider.
  * Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER.
  *****************************************************************************/
-void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
+void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position,
+                     short i_type )
 {
     vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT,
                                              FIND_ANYWHERE );
@@ -422,7 +424,7 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
         return;
     }
 
-    p_subpic = vout_CreateWidget( p_vout );
+    p_subpic = vout_CreateWidget( p_vout, i_channel );
     if( p_subpic == NULL )
     {
         return;
@@ -481,17 +483,8 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
                   p_widget->i_height - 1, STYLE_EMPTY );
     }
 
-    vlc_mutex_lock( &p_vout->change_lock );
-
-    if( p_vout->p_last_osd_message )
-    {
-        vout_DestroySubPicture( p_vout, p_vout->p_last_osd_message );
-    }
-    p_vout->p_last_osd_message = p_subpic;
     vout_DisplaySubPicture( p_vout, p_subpic );
 
-    vlc_mutex_unlock( &p_vout->change_lock );
-
     vlc_object_release( p_vout );
     return;
 }
@@ -506,14 +499,24 @@ void vout_OSDIcon( vlc_object_t *p_caller, short i_type )
                                              FIND_ANYWHERE );
     subpicture_t *p_subpic;
     subpicture_sys_t *p_widget;
-    int i_x_margin, i_y_margin;
+    int i_x_margin, i_y_margin, i_channel;
 
     if( p_vout == NULL || !config_GetInt( p_caller, "osd" ) )
     {
         return;
     }
 
-    p_subpic = vout_CreateWidget( p_vout );
+    switch( i_type )
+    {
+        case OSD_SPEAKER_ICON:
+            i_channel = VOLUME_CHAN;
+            break;
+        default:
+            i_channel = SOLO_CHAN;
+            break;
+    }
+
+    p_subpic = vout_CreateWidget( p_vout, i_channel );
     if( p_subpic == NULL )
     {
         return;
@@ -575,17 +578,8 @@ void vout_OSDIcon( vlc_object_t *p_caller, short i_type )
         }
     }
 
-    vlc_mutex_lock( &p_vout->change_lock );
-
-    if( p_vout->p_last_osd_message )
-    {
-        vout_DestroySubPicture( p_vout, p_vout->p_last_osd_message );
-    }
-    p_vout->p_last_osd_message = p_subpic;
     vout_DisplaySubPicture( p_vout, p_subpic );
 
-    vlc_mutex_unlock( &p_vout->change_lock );
-
     vlc_object_release( p_vout );
     return;
 }
index deb590de212cf9750242fccb25817556e166cca0..0baa6e02a7ca3d26cd262ff49c8c50598583ef35 100644 (file)
@@ -82,7 +82,8 @@ void  vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
  * \param i_type the type of the subpicture
  * \return NULL on error, a reserved subpicture otherwise
  */
-subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type )
+subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_channel,
+                                     int i_content, int i_type )
 {
     int                 i_subpic;                        /* subpicture index */
     subpicture_t *      p_subpic = NULL;            /* first free subpicture */
@@ -90,9 +91,40 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type )
     /* Get lock */
     vlc_mutex_lock( &p_vout->subpicture_lock );
 
+    /*
+     * Destroy all subpics which are not in the correct channel and
+     * subpics which are in the right channel and have the same content type
+     * (only concerns exclusive channels)
+     */
+    if( i_channel >= BEGIN_EXCLUSIVE_CHAN )
+    {
+        for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
+        {
+            p_subpic = &p_vout->p_subpicture[i_subpic];
+            if( p_subpic->i_status == FREE_SUBPICTURE
+                || ( p_subpic->i_status != RESERVED_SUBPICTURE
+                     && p_subpic->i_status != READY_SUBPICTURE ) )
+            {
+                continue;
+            }
+            if( ( p_subpic->i_channel != i_channel
+                  && p_subpic->i_channel >= BEGIN_EXCLUSIVE_CHAN )
+                || ( p_subpic->i_channel == i_channel
+                     && p_subpic->i_content == i_content ) )
+            {
+                if( p_subpic->pf_destroy )
+                {
+                    p_subpic->pf_destroy( p_subpic );
+                }
+                p_subpic->i_status = FREE_SUBPICTURE;
+            }
+        }
+    }
+
     /*
      * Look for an empty place
      */
+    p_subpic = NULL;
     for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
     {
         if( p_vout->p_subpicture[i_subpic].i_status == FREE_SUBPICTURE )
@@ -113,6 +145,9 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type )
     }
 
     /* Copy subpicture information, set some default values */
+    p_subpic->i_channel = i_channel;
+    p_subpic->i_content = i_content;
+
     p_subpic->i_type    = i_type;
     p_subpic->i_status  = RESERVED_SUBPICTURE;
 
@@ -163,11 +198,6 @@ void vout_DestroySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
         p_subpic->pf_destroy( p_subpic );
     }
 
-    if( p_subpic == p_vout->p_last_osd_message )
-    {
-        p_vout->p_last_osd_message = NULL;
-    }
-
     p_subpic->i_status = FREE_SUBPICTURE;
 
     vlc_mutex_unlock( &p_vout->subpicture_lock );