#define SUBPICTURE_ALIGN_RIGHT 0x2
#define SUBPICTURE_ALIGN_TOP 0x4
#define SUBPICTURE_ALIGN_BOTTOM 0x8
+#define SUBPICTURE_ALIGN_LEAVETEXT 0x10 /**< Align the subpicture, but not the text inside */
#define SUBPICTURE_ALIGN_MASK ( SUBPICTURE_ALIGN_LEFT|SUBPICTURE_ALIGN_RIGHT| \
- SUBPICTURE_ALIGN_TOP |SUBPICTURE_ALIGN_BOTTOM )
-
+ SUBPICTURE_ALIGN_TOP |SUBPICTURE_ALIGN_BOTTOM| \
+ SUBPICTURE_ALIGN_LEAVETEXT )
/**
* This function will create a new subpicture region.
*
subpicture_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
- p_spu_sys->align = SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT;
+ /* The "leavetext" alignment is a special mode where the subpicture
+ region itself gets aligned, but the text inside it does not */
+ p_spu_sys->align = SUBPICTURE_ALIGN_LEAVETEXT;
p_spu_sys->text = psz_subtitle;
p_spu_sys->html = psz_html;
p_spu_sys->i_font_height_percent = 5;
/* Left offset to take into account alignment */
if( (p_region->i_align & 0x3) == SUBPICTURE_ALIGN_RIGHT )
i_align_left += ( i_text_width - p_line->i_width );
+ else if( (p_region->i_align & 0x10) == SUBPICTURE_ALIGN_LEAVETEXT)
+ i_align_left = i_margin; /* Keep it the way it is */
else if( (p_region->i_align & 0x3) != SUBPICTURE_ALIGN_LEFT )
i_align_left += ( i_text_width - p_line->i_width ) / 2;
}