]> git.sesse.net Git - vlc/commitdiff
* changed default value of sub-margin to 0
authorDerk-Jan Hartman <hartman@videolan.org>
Mon, 31 Oct 2005 01:46:14 +0000 (01:46 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Mon, 31 Oct 2005 01:46:14 +0000 (01:46 +0000)
* sub elements can be moved up (positive values) and down (negative)
* force_crop'ed elements cannot be moves (usually only dvd menu's)
* works for spudec and subsdec
* if the margin / offset correction forces the picture out of the main picture, the offset is cropped so that the subpicture is still 100% visible.

src/libvlc.h
src/video_output/vout_subpictures.c

index 8a1cebcd77ea1e0b103b985851ff5081f1c385f4..690e913009a8a7e397e7108ec637c89ca6389465 100644 (file)
@@ -1076,7 +1076,7 @@ vlc_module_begin();
 #endif
     add_string( "sub-autodetect-path", SUB_PATH, NULL,
                  SUB_PATH_TEXT, SUB_PATH_LONGTEXT, VLC_TRUE );
-    add_integer( "sub-margin", -1, NULL, SUB_MARGIN_TEXT,
+    add_integer( "sub-margin", 0, NULL, SUB_MARGIN_TEXT,
                  SUB_MARGIN_LONGTEXT, VLC_TRUE );
         add_deprecated( "spu-margin", VLC_FALSE ); /*Deprecated since 0.8.2 */
     set_section( N_( "Overlays" ) , NULL );
index 33d8a5f06ba8e420b141f8640bf8c59a82ab9e34..1c980222f4e59c70d3dd2c1617f530e84d4fa921 100644 (file)
@@ -694,15 +694,18 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
                 i_y_offset = p_region->i_y +
                     p_subpic->i_y * i_scale_height / 1000;
 
-                if( p_spu->i_margin >= 0 )
-                {
-                    if( p_subpic->i_height + (unsigned int)p_spu->i_margin <=
-                        p_fmt->i_height )
-                    {
-                        i_y_offset = p_fmt->i_height -
-                            p_spu->i_margin - p_subpic->i_height;
-                    }
-                }
+            }
+
+            if( p_spu->i_margin != 0 && p_spu->b_force_crop == VLC_FALSE )
+            {
+                int i_diff = 0;
+                int i_low = i_y_offset - p_spu->i_margin;
+                int i_high = i_y_offset + p_region->fmt.i_height - p_spu->i_margin;
+
+                /* crop extra margin to keep within bounds */
+                if( i_low < 0 ) i_diff = i_low;
+                if( i_high > (int)p_fmt->i_height ) i_diff = i_high - p_fmt->i_height;
+                i_y_offset -= ( p_spu->i_margin + i_diff );
             }
 
             p_spu->p_blend->fmt_in.video = p_region->fmt;