]> git.sesse.net Git - vlc/commitdiff
* src/video_output/video_widgets.c: Added OSD sliders when changing volume or positio...
authorYoann Peronneau <yoann@videolan.org>
Sun, 23 May 2004 16:19:29 +0000 (16:19 +0000)
committerYoann Peronneau <yoann@videolan.org>
Sun, 23 May 2004 16:19:29 +0000 (16:19 +0000)
Those sliders are graphical (ie not written with characters) and we can now add others OSD "widgets".

Makefile.am
include/osd.h
modules/control/hotkeys.c
src/video_output/video_widgets.c [new file with mode: 0644]
src/video_output/vout_subpictures.c

index 7515cbae5a1963d6c270f3920b647997ffcd212b..9cdb50d8c494d8889022ad33c4d65f80e0fcd040 100644 (file)
@@ -337,6 +337,7 @@ SOURCES_libvlc_common = \
        src/video_output/vout_pictures.c \
        src/video_output/vout_pictures.h \
        src/video_output/video_text.c \
+       src/video_output/video_widgets.c \
        src/video_output/vout_subpictures.c \
        src/video_output/vout_synchro.c \
        src/video_output/vout_intf.c \
index 7fbf49ab81f9f9817931d438a12a267cf085d590..e1160f032821a3bf0212d0b35561af67eaa51b31 100644 (file)
@@ -56,3 +56,4 @@ VLC_EXPORT( void,  __vout_OSDMessage, ( vlc_object_t *, char *, ... ) );
 #else
 #    define vout_OSDMessage __vout_OSDMessage
 #endif
+VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int , short ) );
index 5281ee6267cd76fe48c30b0a1354b662253ad527..eb54e2b2eacdbe44ff44e175ba3790e101b56fd5 100755 (executable)
@@ -65,6 +65,7 @@ static int  ActionKeyCB( vlc_object_t *, char const *,
                          vlc_value_t, vlc_value_t, void * );
 static void PlayBookmark( intf_thread_t *, int );
 static void SetBookmark ( intf_thread_t *, int );
+static int  GetPosition ( intf_thread_t * );
 
 /*****************************************************************************
  * Module descriptor
@@ -238,13 +239,32 @@ static void Run( intf_thread_t *p_intf )
         {
             audio_volume_t i_newvol;
             aout_VolumeUp( p_intf, 1, &i_newvol );
-            vout_OSDMessage( p_intf, "Vol %d%%", i_newvol*100/AOUT_VOLUME_MAX );
+            if( p_vout->b_fullscreen )
+            {
+                vout_OSDSlider( VLC_OBJECT( p_intf ),
+                                i_newvol*100/AOUT_VOLUME_MAX, 1 );
+            }
+            else
+            {
+                vout_OSDMessage( p_intf, "Vol %d%%",
+                                 2*i_newvol*100/AOUT_VOLUME_MAX );
+            }
         }
         else if( i_action == ACTIONID_VOL_DOWN )
         {
             audio_volume_t i_newvol;
             aout_VolumeDown( p_intf, 1, &i_newvol );
-            vout_OSDMessage( p_intf, "Vol %d%%", i_newvol*100/AOUT_VOLUME_MAX);
+            if( p_vout->b_fullscreen )
+            {
+                vout_OSDSlider( VLC_OBJECT( p_intf ),
+                                i_newvol*100/AOUT_VOLUME_MAX, 1 );
+            }
+            else
+            {
+                vout_OSDMessage( p_intf, "Vol %d%%",
+                                 2*i_newvol*100/AOUT_VOLUME_MAX );
+            }
+
         }
         else if( i_action == ACTIONID_SUBDELAY_DOWN )
         {
@@ -324,47 +344,98 @@ static void Run( intf_thread_t *p_intf )
         }
         else if( p_input )
         {
+            vlc_bool_t b_seekable = p_input->stream.b_seekable;
+
             if( i_action == ACTIONID_PAUSE )
             {
                 vout_OSDMessage( p_intf, _( "Pause" ) );
                 val.i_int = PAUSE_S;
                 var_Set( p_input, "state", val );
             }
-            else if( i_action == ACTIONID_JUMP_BACKWARD_10SEC )
+            else if( i_action == ACTIONID_JUMP_BACKWARD_10SEC && b_seekable )
             {
-                vout_OSDMessage( p_intf, _( "Jump -10 seconds" ) );
                 val.i_time = -10000000;
                 var_Set( p_input, "time-offset", val );
+                if( p_vout->b_fullscreen )
+                {
+                    vout_OSDSlider( VLC_OBJECT( p_intf ),
+                                    GetPosition( p_intf ), 0 );
+                }
+                else
+                {
+                    vout_OSDMessage( p_intf, _( "Jump -10 seconds" ) );
+                }
             }
-            else if( i_action == ACTIONID_JUMP_FORWARD_10SEC )
+            else if( i_action == ACTIONID_JUMP_FORWARD_10SEC && b_seekable )
             {
-                vout_OSDMessage( p_intf, _( "Jump +10 seconds" ) );
                 val.i_time = 10000000;
                 var_Set( p_input, "time-offset", val );
+                if( p_vout->b_fullscreen )
+                {
+                    vout_OSDSlider( VLC_OBJECT( p_intf ),
+                                    GetPosition( p_intf ), 0 );
+                }
+                else
+                {
+                    vout_OSDMessage( p_intf, _( "Jump +10 seconds" ) );
+                }
             }
-            else if( i_action == ACTIONID_JUMP_BACKWARD_1MIN )
+            else if( i_action == ACTIONID_JUMP_BACKWARD_1MIN && b_seekable )
             {
-                vout_OSDMessage( p_intf, _( "Jump -1 minute" ) );
                 val.i_time = -60000000;
                 var_Set( p_input, "time-offset", val );
+                if( p_vout->b_fullscreen )
+                {
+                    vout_OSDSlider( VLC_OBJECT( p_intf ),
+                                    GetPosition( p_intf ), 0 );
+                }
+                else
+                {
+                    vout_OSDMessage( p_intf, _( "Jump -1 minute" ) );
+                }
             }
-            else if( i_action == ACTIONID_JUMP_FORWARD_1MIN )
+            else if( i_action == ACTIONID_JUMP_FORWARD_1MIN && b_seekable )
             {
-                vout_OSDMessage( p_intf, _( "Jump +1 minute" ) );
                 val.i_time = 60000000;
                 var_Set( p_input, "time-offset", val );
+                if( p_vout->b_fullscreen )
+                {
+                    vout_OSDSlider( VLC_OBJECT( p_intf ),
+                                    GetPosition( p_intf ), 0 );
+                }
+                else
+                {
+                    vout_OSDMessage( p_intf, _( "Jump +1 minute" ) );
+                }
             }
-            else if( i_action == ACTIONID_JUMP_BACKWARD_5MIN )
+            else if( i_action == ACTIONID_JUMP_BACKWARD_5MIN && b_seekable )
             {
                 vout_OSDMessage( p_intf, _( "Jump -5 minutes" ) );
                 val.i_time = -300000000;
                 var_Set( p_input, "time-offset", val );
+                if( p_vout->b_fullscreen )
+                {
+                    vout_OSDSlider( VLC_OBJECT( p_intf ),
+                                    GetPosition( p_intf ), 0 );
+                }
+                else
+                {
+                    vout_OSDMessage( p_intf, _( "Jump -5 minutes" ) );
+                }
             }
-            else if( i_action == ACTIONID_JUMP_FORWARD_5MIN )
+            else if( i_action == ACTIONID_JUMP_FORWARD_5MIN && b_seekable )
             {
-                vout_OSDMessage( p_intf, _( "Jump +5 minutes" ) );
                 val.i_time = 300000000;
                 var_Set( p_input, "time-offset", val );
+                if( p_vout->b_fullscreen )
+                {
+                    vout_OSDSlider( VLC_OBJECT( p_intf ),
+                                    GetPosition( p_intf ), 0 );
+                }
+                else
+                {
+                    vout_OSDMessage( p_intf, _( "Jump +5 minutes" ) );
+                }
             }
             else if( i_action == ACTIONID_NEXT )
             {
@@ -553,3 +624,18 @@ static void SetBookmark( intf_thread_t *p_intf, int i_num )
         vlc_object_release( p_playlist );
     }
 }
+
+static int GetPosition( intf_thread_t *p_intf )
+{
+    input_thread_t *p_input =
+        (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
+                                               FIND_ANYWHERE );
+    if( p_input )
+    {
+        vlc_value_t pos;
+        var_Get( p_input, "position", &pos );
+        vlc_object_release( p_input );
+        return pos.f_float * 100;
+    }
+    return -1;
+}
diff --git a/src/video_output/video_widgets.c b/src/video_output/video_widgets.c
new file mode 100644 (file)
index 0000000..acb03b8
--- /dev/null
@@ -0,0 +1,428 @@
+/*****************************************************************************
+ * video_widgets.c : widgets manipulation functions
+ *****************************************************************************
+ * Copyright (C) 1999-2004 VideoLAN
+ * $Id:$
+ *
+ * Author: Yoann Peronneau <yoann@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include <stdlib.h>                                                /* free() */
+#include <vlc/vout.h>
+#include <osd.h>
+
+#define RECT_EMPTY 0
+#define RECT_FILLED 1
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static void DrawRect  ( vout_thread_t *, subpicture_t *, int, int, int, int,
+                        short );
+static void Render    ( vout_thread_t *, picture_t *, const subpicture_t * );
+static void RenderI420( vout_thread_t *, picture_t *, const subpicture_t *,
+                        int );
+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 void FreeWidget( subpicture_t * );
+
+/**
+ * Private data in a subpicture.
+ */
+struct subpicture_sys_t
+{
+    int     i_x;
+    int     i_y;
+    int     i_width;
+    int     i_height;
+    uint8_t *p_pic;
+};
+
+/*****************************************************************************
+ * Draws a rectangle at the given position in the subpic.
+ * It may be filled (fill == RECT_FILLED) or empty (fill == RECT_EMPTY).
+ *****************************************************************************/
+static void DrawRect( vout_thread_t *p_vout, subpicture_t *p_subpic,
+                      int i_x1, int i_y1, int i_x2, int i_y2, short fill )
+{
+    int x, y;
+    subpicture_sys_t *p_widget = p_subpic->p_sys;
+
+    if( fill == RECT_FILLED )
+    {
+        for( y = i_y1; y <= i_y2; y++ )
+        {
+            for( x = i_x1; x <= i_x2; x++ )
+            {
+                p_widget->p_pic[ x + p_widget->i_width * y ] = 1;
+            }
+        }
+    }
+    else
+    {
+        for( y = i_y1; y <= i_y2; y++ )
+        {
+            p_widget->p_pic[ i_x1 + p_widget->i_width * y ] = 1;
+            p_widget->p_pic[ i_x2 + p_widget->i_width * y ] = 1;
+        }
+        for( x = i_x1; x <= i_x2; x++ )
+        {
+            p_widget->p_pic[ x + p_widget->i_width * i_y1 ] = 1;
+            p_widget->p_pic[ x + p_widget->i_width * i_y2 ] = 1;
+        }
+    }
+}
+
+/*****************************************************************************
+ * Render: place string in picture
+ *****************************************************************************
+ * This function merges the previously rendered freetype glyphs into a picture
+ *****************************************************************************/
+static void Render( vout_thread_t *p_vout, picture_t *p_pic,
+                    const subpicture_t *p_subpic )
+{
+    int i_fade_alpha = 255;
+    mtime_t i_fade_start = ( p_subpic->i_stop + p_subpic->i_start ) / 2;
+    mtime_t i_now = mdate();
+
+    if( i_now >= i_fade_start )
+    {
+        i_fade_alpha = 255 * ( p_subpic->i_stop - i_now ) /
+                       ( p_subpic->i_stop - i_fade_start );
+    }
+
+    switch( p_vout->output.i_chroma )
+    {
+        /* I420 target, no scaling */
+        case VLC_FOURCC('I','4','2','0'):
+        case VLC_FOURCC('I','Y','U','V'):
+        case VLC_FOURCC('Y','V','1','2'):
+            RenderI420( p_vout, p_pic, p_subpic, i_fade_alpha );
+            break;
+        /* RV32 target, scaling */
+        case VLC_FOURCC('R','V','2','4'):
+        case VLC_FOURCC('R','V','3','2'):
+            RenderRV32( p_vout, p_pic, p_subpic, i_fade_alpha );
+            break;
+        /* NVidia or BeOS overlay, no scaling */
+        case VLC_FOURCC('Y','U','Y','2'):
+            RenderYUY2( p_vout, p_pic, p_subpic, i_fade_alpha );
+            break;
+
+        default:
+            msg_Err( p_vout, "unknown chroma, can't render SPU" );
+            break;
+    }
+}
+
+/**
+ * Draw a widget on a I420 (or similar) picture
+ */
+static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
+                    const subpicture_t *p_subpic, int i_fade_alpha )
+{
+    subpicture_sys_t *p_widget = p_subpic->p_sys;
+    int i_plane, x, y, pen_x, pen_y;
+
+    for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
+    {
+        uint8_t *p_in;
+        int i_pic_pitch = p_pic->p[ i_plane ].i_pitch;
+
+        p_in = p_pic->p[ i_plane ].p_pixels;
+
+        if ( i_plane == 0 )
+        {
+            pen_x = p_widget->i_x;
+            pen_y = p_widget->i_y;
+#define alpha p_widget->p_pic[ x + y * p_widget->i_width ] * i_fade_alpha
+#define pixel p_in[ ( pen_y + y ) * i_pic_pitch + pen_x + x ]
+            for( y = 0; y < p_widget->i_height; y++ )
+            {
+                for( x = 0; x < p_widget->i_width; x++ )
+                {
+                    pen_y--;
+                    pixel = ( ( pixel * ( 255 - alpha ) ) >> 8 );
+                    pen_y++; pen_x--;
+                    pixel = ( ( pixel * ( 255 - alpha ) ) >> 8 );
+                    pen_x += 2;
+                    pixel = ( ( pixel * ( 255 - alpha ) ) >> 8 );
+                    pen_y++; pen_x--;
+                    pixel = ( ( pixel * ( 255 - alpha ) ) >> 8 );
+                    pen_y--;
+                }
+            }
+            for( y = 0; y < p_widget->i_height; y++ )
+            {
+                for( x = 0; x < p_widget->i_width; x++ )
+                {
+                    pixel = ( ( pixel * ( 255 - alpha ) ) >> 8 ) +
+                            ( 255 * alpha >> 8 );
+                 }
+             }
+#undef alpha
+#undef pixel
+        }
+        else
+        {
+            pen_x = p_widget->i_x >> 1;
+            pen_y = p_widget->i_y >> 1;
+#define alpha p_widget->p_pic[ x + y * p_widget->i_width ] * i_fade_alpha
+#define pixel p_in[ ( pen_y + (y >> 1) ) * i_pic_pitch + pen_x + (x >> 1) ]
+            for( y = 0; y < p_widget->i_height; y+=2 )
+            {
+                for( x = 0; x < p_widget->i_width; x+=2 )
+                {
+                    pixel = ( ( pixel * ( 0xFF - alpha ) ) >> 8 ) +
+                        ( 0x80 * alpha >> 8 );
+                }
+            }
+#undef alpha
+#undef pixel
+        }
+    }
+
+}
+
+/**
+ * Draw a widget on a YUY2 picture
+ */
+static void RenderYUY2( vout_thread_t *p_vout, picture_t *p_pic,
+                        const subpicture_t *p_subpic, int i_fade_alpha )
+{
+    subpicture_sys_t *p_widget = p_subpic->p_sys;
+    int x, y, pen_x, pen_y;
+    uint8_t *p_in;
+    int i_pic_pitch = p_pic->p[0].i_pitch;
+
+    pen_x = p_widget->i_x;
+    pen_y = p_widget->i_y;
+#define alpha p_widget->p_pic[ x + y * p_widget->i_width ] * i_fade_alpha
+#define pixel p_in[ ( pen_y + y ) * i_pic_pitch + 2 * ( pen_x + x ) ]
+    for( y = 0; y < p_widget->i_height; y++ )
+    {
+        for( x = 0; x < p_widget->i_width; x++ )
+        {
+            pen_y--;
+            pixel = ( ( pixel * ( 255 - alpha ) ) >> 8 );
+            pen_y++; pen_x--;
+            pixel = ( ( pixel * ( 255 - alpha ) ) >> 8 );
+            pen_x += 2;
+            pixel = ( ( pixel * ( 255 - alpha ) ) >> 8 );
+            pen_y++; pen_x--;
+            pixel = ( ( pixel * ( 255 - alpha ) ) >> 8 );
+            pen_y--;
+        }
+    }
+    for( y = 0; y < p_widget->i_height; y++ )
+    {
+        for( x = 0; x < p_widget->i_width; x++ )
+        {
+            pixel = ( ( pixel * ( 255 - alpha ) ) >> 8 ) +
+                    ( 255 * alpha >> 8 );
+         }
+     }
+#undef alpha
+#undef pixel
+}
+
+/**
+ * Draw a widget on a RV32 picture
+ */
+static void RenderRV32( vout_thread_t *p_vout, picture_t *p_pic,
+                    const subpicture_t *p_subpic, int i_fade_alpha )
+{
+    subpicture_sys_t *p_widget = p_subpic->p_sys;
+    int x, y, pen_x, pen_y;
+    uint8_t *p_in;
+    int i_pic_pitch = p_pic->p[0].i_pitch;
+
+    pen_x = p_widget->i_x;
+    pen_y = p_widget->i_y;
+
+#define alpha p_widget->p_pic[ x + y * p_widget->i_width ] * i_fade_alpha
+#define pixel( c ) p_in[ ( pen_y + y ) * i_pic_pitch + 4 * ( pen_x + x ) + c ]
+    for(y = 0; y < p_widget->i_height; y++ )
+    {
+        for( x = 0; x < p_widget->i_width; x++ )
+        {
+            pen_y--;
+            pixel( 0 ) = ( ( pixel( 0 ) * ( 255 - alpha ) ) >> 8 );
+            pixel( 1 ) = ( ( pixel( 1 ) * ( 255 - alpha ) ) >> 8 );
+            pixel( 2 ) = ( ( pixel( 2 ) * ( 255 - alpha ) ) >> 8 );
+            pen_y++; pen_x--;
+            pixel( 0 ) = ( ( pixel( 0 ) * ( 255 - alpha ) ) >> 8 );
+            pixel( 1 ) = ( ( pixel( 1 ) * ( 255 - alpha ) ) >> 8 );
+            pixel( 2 ) = ( ( pixel( 2 ) * ( 255 - alpha ) ) >> 8 );
+            pen_x += 2;
+            pixel( 0 ) = ( ( pixel( 0 ) * ( 255 - alpha ) ) >> 8 );
+            pixel( 1 ) = ( ( pixel( 1 ) * ( 255 - alpha ) ) >> 8 );
+            pixel( 2 ) = ( ( pixel( 2 ) * ( 255 - alpha ) ) >> 8 );
+            pen_y++; pen_x--;
+            pixel( 0 ) = ( ( pixel( 0 ) * ( 255 - alpha ) ) >> 8 );
+            pixel( 1 ) = ( ( pixel( 1 ) * ( 255 - alpha ) ) >> 8 );
+            pixel( 2 ) = ( ( pixel( 2 ) * ( 255 - alpha ) ) >> 8 );
+            pen_y--;
+        }
+    }
+    for(y = 0; y < p_widget->i_height; y++ )
+    {
+        for( x = 0; x < p_widget->i_width; x++ )
+        {
+            pixel( 0 ) = ( ( pixel( 0 ) * ( 255 - alpha ) ) >> 8 ) +
+                ( 255 * alpha >> 8 );
+            pixel( 1 ) = ( ( pixel( 1 ) * ( 255 - alpha ) ) >> 8 ) +
+                ( 255 * alpha >> 8 );
+            pixel( 2 ) = ( ( pixel( 2 ) * ( 255 - alpha ) ) >> 8 ) +
+                ( 255 * alpha >> 8 );
+        }
+    }
+#undef alpha
+#undef pixel
+}
+
+/*****************************************************************************
+ * Displays an OSD slider.
+ * Type 0 is position slider-like, and type 1 is volume slider-like.
+ *****************************************************************************/
+void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
+{
+    vout_thread_t *p_vout;
+    subpicture_t *p_subpic;
+    subpicture_sys_t *p_widget;
+    mtime_t i_now = mdate();
+    int i_x_margin, i_y_margin;
+
+    if( !config_GetInt( p_caller, "osd" ) || i_position < 0 ) return;
+
+    p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, FIND_ANYWHERE );
+
+    if( p_vout )
+    {
+        p_subpic = 0;
+        p_widget = 0;
+
+        /* Create and initialize a subpicture */
+        p_subpic = vout_CreateSubPicture( p_vout, MEMORY_SUBPICTURE );
+        if( p_subpic == NULL )
+        {
+            return;
+        }
+        p_subpic->pf_render = Render;
+        p_subpic->pf_destroy = FreeWidget;
+        p_subpic->i_start = i_now;
+        p_subpic->i_stop = i_now + 1200000;
+        p_subpic->b_ephemer = VLC_FALSE;
+
+        p_widget = malloc( sizeof(subpicture_sys_t) );
+        if( p_widget == NULL )
+        {
+            FreeWidget( p_subpic );
+            vout_DestroySubPicture( p_vout, p_subpic );
+            return;
+        }
+        p_subpic->p_sys = p_widget;
+
+        i_y_margin = p_vout->render.i_height / 10;
+        i_x_margin = i_y_margin;
+        if( i_type == 0 )
+        {
+            p_widget->i_width = p_vout->render.i_width - 2 * i_x_margin;
+            p_widget->i_height = p_vout->render.i_height / 20;
+            p_widget->i_x = i_x_margin;
+            p_widget->i_y = p_vout->render.i_height - i_y_margin -
+                            p_widget->i_height;
+        }
+        else
+        {
+            p_widget->i_width = p_vout->render.i_width / 40;
+            p_widget->i_height = p_vout->render.i_height - 2 * i_y_margin;
+            p_widget->i_height = ( ( p_widget->i_height - 2 ) >> 2 ) * 4 + 2;
+            p_widget->i_x = p_vout->render.i_width - i_x_margin -
+                            p_widget->i_width;
+            p_widget->i_y = i_y_margin;
+        }
+
+        p_widget->p_pic = (uint8_t *)malloc( p_widget->i_width *
+                                             p_widget->i_height );
+        if( p_widget->p_pic == NULL )
+        {
+            FreeWidget( p_subpic );
+            vout_DestroySubPicture( p_vout, p_subpic );
+            return;
+        }
+        memset( p_widget->p_pic, 0, p_widget->i_width * p_widget->i_height );
+
+        if( i_type == 0 )
+        {
+            int i_x_pos = ( p_widget->i_width - 2 ) * i_position / 100;
+            int i_y_pos = p_widget->i_height / 2;
+            DrawRect( p_vout, p_subpic, i_x_pos - 1, 2, i_x_pos + 1,
+                      p_widget->i_height - 3, RECT_FILLED );
+            DrawRect( p_vout, p_subpic, 0, 0, p_widget->i_width - 1,
+                      p_widget->i_height - 1, RECT_EMPTY );
+        }
+        else if( i_type == 1 )
+        {
+            int i_y_pos = p_widget->i_height / 2;
+            DrawRect( p_vout, p_subpic, 2, p_widget->i_height -
+                      ( p_widget->i_height - 2 ) * i_position / 100,
+                      p_widget->i_width - 3, p_widget->i_height - 3,
+                      RECT_FILLED );
+            DrawRect( p_vout, p_subpic, 1, i_y_pos, 1, i_y_pos, RECT_FILLED );
+            DrawRect( p_vout, p_subpic, p_widget->i_width - 2, i_y_pos,
+                      p_widget->i_width - 2, i_y_pos, RECT_FILLED );
+            DrawRect( p_vout, p_subpic, 0, 0, p_widget->i_width - 1,
+                      p_widget->i_height - 1, RECT_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;
+}
+
+/**
+ * Frees the widget.
+ */
+static void FreeWidget( subpicture_t *p_subpic )
+{
+    subpicture_sys_t *p_widget = p_subpic->p_sys;
+
+    if( p_subpic->p_sys == NULL ) return;
+
+    if( p_widget->p_pic != NULL )
+    {
+        free( p_widget->p_pic );
+    }
+    free( p_widget );
+}
index a7611ad5fb319682279d35f114567ca4201221d3..deb590de212cf9750242fccb25817556e166cca0 100644 (file)
@@ -2,7 +2,7 @@
  * vout_subpictures.c : subpicture management functions
  *****************************************************************************
  * Copyright (C) 2000-2004 VideoLAN
- * $Id: vout_subpictures.c,v 1.24 2004/01/06 12:02:06 zorglub Exp $
+ * $Id$
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -272,7 +272,8 @@ subpicture_t *vout_SortSubPictures( vout_thread_t *p_vout,
                 p_vout->p_subpicture[i_index].p_next = p_subpic;
                 p_subpic = &p_vout->p_subpicture[i_index];
 
-                /* If it's the 2nd youngest subpicture, register its date */                    if( !ephemer_date || ephemer_date > p_subpic->i_start )
+                /* If it's the 2nd youngest subpicture, register its date */
+                if( !ephemer_date || ephemer_date > p_subpic->i_start )
                 {
                     ephemer_date = p_subpic->i_start;
                 }