]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/osdmenu.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / video_filter / osdmenu.c
index afe7e423d3e5794b46eb3e21db56564d53c43290..500a625db9e0e4323ee9ff24930c745bf417637c 100644 (file)
@@ -24,8 +24,6 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>
-#include <string.h>
 #include <vlc/vlc.h>
 #include <vlc_vout.h>
 #include <vlc_filter.h>
@@ -102,7 +100,7 @@ static int OSDMenuCallback( vlc_object_t *, char const *,
 #endif
 
 #define OSD_UPDATE_MIN     0
-#define OSD_UPDATE_DEFAULT 0
+#define OSD_UPDATE_DEFAULT 300
 #define OSD_UPDATE_MAX     1000
 
 vlc_module_begin();
@@ -128,10 +126,10 @@ vlc_module_begin();
     set_description( _("On Screen Display menu") );
     set_shortname( _("OSD menu") );
     add_shortcut( "osdmenu" );
-/*
+
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_SUBPIC );
-*/
+
     set_callbacks( CreateFilter, DestroyFilter );
 vlc_module_end();
 
@@ -144,7 +142,7 @@ vlc_module_end();
  *****************************************************************************/
 struct filter_sys_t
 {
-    int          position;      /* relative positioning of SPU images */
+    int          i_position;    /* relative positioning of SPU images */
     int          i_x;           /* absolute positioning of SPU images */
     int          i_y;           /* absolute positioning of SPU images */
     mtime_t      i_last_date;   /* last mdate SPU object has been sent to SPU subsytem */
@@ -192,7 +190,7 @@ static int CreateFilter ( vlc_object_t *p_this )
 
     p_sys->i_x = var_CreateGetIntegerCommand( p_this, OSD_CFG "x" );
     p_sys->i_y = var_CreateGetIntegerCommand( p_this, OSD_CFG "y" );
-    p_sys->position = var_CreateGetIntegerCommand( p_this, OSD_CFG "position" );
+    p_sys->i_position = var_CreateGetIntegerCommand( p_this, OSD_CFG "position" );
     p_sys->i_alpha = var_CreateGetIntegerCommand( p_this, OSD_CFG "alpha" );
 
     /* in micro seconds - divide by 2 to match user expectations */
@@ -313,6 +311,7 @@ static int OSDMenuVisibleEvent( vlc_object_t *p_this, char const *psz_var,
     filter_t *p_filter = (filter_t *) p_data;
 
     p_filter->p_sys->b_visible = VLC_TRUE;
+    p_filter->p_sys->b_update = VLC_TRUE;
     return VLC_SUCCESS;
 }
 
@@ -320,9 +319,10 @@ static int OSDMenuUpdateEvent( vlc_object_t *p_this, char const *psz_var,
                     vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
     filter_t *p_filter = (filter_t *) p_data;
+    filter_sys_t *p_sys = p_filter->p_sys;
 
-    p_filter->p_sys->b_update = VLC_TRUE;
-    p_filter->p_sys->i_end_date = (mtime_t) 0;
+    p_sys->b_update = p_sys->b_visible ? VLC_TRUE : VLC_FALSE;
+    p_sys->i_end_date = (mtime_t) 0;
     return VLC_SUCCESS;
 }
 
@@ -330,7 +330,7 @@ static int OSDMenuUpdateEvent( vlc_object_t *p_this, char const *psz_var,
 /*****************************************************************************
  * create_text_region : compose a text region SPU
  *****************************************************************************/
-static subpicture_region_t *create_text_region( filter_t *p_filter, subpicture_t *p_spu, 
+static subpicture_region_t *create_text_region( filter_t *p_filter, subpicture_t *p_spu,
     int i_width, int i_height, const char *psz_text )
 {
     subpicture_region_t *p_region;
@@ -351,10 +351,10 @@ static subpicture_region_t *create_text_region( filter_t *p_filter, subpicture_t
         return NULL;
     }
     p_region->psz_text = strdup( psz_text );
-    p_region->i_x = 0; 
+    p_region->i_x = 0;
     p_region->i_y = 40;
-#if 1
-    msg_Dbg( p_filter, "SPU text region position (%d,%d) (%d,%d) [%s]", 
+#if 0
+    msg_Dbg( p_filter, "SPU text region position (%d,%d) (%d,%d) [%s]",
         p_region->i_x, p_region->i_y,
         p_region->fmt.i_width, p_region->fmt.i_height, p_region->psz_text );
 #endif
@@ -400,7 +400,7 @@ static subpicture_region_t *create_picture_region( filter_t *p_filter, subpictur
 
     p_region->i_x = 0;
     p_region->i_y = 0;
-    p_region->i_align = SUBPICTURE_ALIGN_LEFT;
+    p_region->i_align = p_filter->p_sys->i_position;
 #if 0
     msg_Dbg( p_filter, "SPU picture region position (%d,%d) (%d,%d) [%p]",
         p_region->i_x, p_region->i_y,
@@ -439,7 +439,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
         p_spu->b_absolute = VLC_TRUE;
     else
         p_spu->b_absolute = p_sys->b_absolute;
-    p_spu->i_flags = p_sys->position;
+    p_spu->i_flags = p_sys->i_position;
 
     /* Determine the duration of the subpicture */
     if( p_sys->i_end_date > 0 )
@@ -585,7 +585,7 @@ static int OSDMenuCallback( vlc_object_t *p_this, char const *psz_var,
         {
             if( newval.i_int == pi_pos_values[i] )
             {
-                p_sys->position = newval.i_int % 11;
+                p_sys->i_position = newval.i_int % 11;
                 break;
             }
         }