#include <vlc_filter.h>
#include <vlc_osd.h>
#include "../libvlc.h"
+#include "vout_internal.h"
#include <assert.h>
#include <limits.h>
/* */
mtime_t i_last_sort_date;
+ /* */
+ mtime_t i_last_render_date;
};
/* */
{
spu_t *p_spu;
spu_private_t *p_sys;
-
+
p_spu = vlc_custom_create( p_this, sizeof(spu_t) + sizeof(spu_private_t),
VLC_OBJECT_GENERIC, "subpicture" );
/* */
p_sys->i_last_sort_date = -1;
+ p_sys->i_last_render_date = -1;
return p_spu;
}
void spu_RenderSubpictures( spu_t *p_spu,
picture_t *p_pic_dst, const video_format_t *p_fmt_dst,
subpicture_t *p_subpic_list,
- const video_format_t *p_fmt_src )
+ const video_format_t *p_fmt_src, bool b_paused )
{
spu_private_t *p_sys = p_spu->p;
p_subpic = p_subpic->p_next )
{
/* */
- if( p_subpic->pf_pre_render )
+ if( !b_paused && p_subpic->pf_pre_render )
p_subpic->pf_pre_render( p_spu, p_subpic, p_fmt_dst );
- if( p_subpic->pf_update_regions )
+ if( !b_paused && p_subpic->pf_update_regions )
{
+ mtime_t i_render_date;
video_format_t fmt_org = *p_fmt_dst;
fmt_org.i_width =
fmt_org.i_visible_width = i_source_video_width;
fmt_org.i_height =
fmt_org.i_visible_height = i_source_video_height;
- p_subpic->pf_update_regions( p_spu, p_subpic, &fmt_org, i_current_date );
+ i_render_date = i_current_date;
+ if( p_subpic->b_subtitle && b_paused && p_sys->i_last_render_date > 0 )
+ i_render_date = p_sys->i_last_render_date;
+
+ p_subpic->pf_update_regions( p_spu, p_subpic, &fmt_org, i_render_date );
}
/* */
pp_subpicture[i_subpicture++] = p_subpic;
}
+ if( !b_paused )
+ p_sys->i_last_render_date = i_current_date;
+
/* Be sure we have at least 1 picture to process */
if( i_subpicture <= 0 )
{
b_late = b_stop_valid && p_current->i_stop <= display_date;
/* start_date will be used for correct automatic overlap support
- * in case picture that should not be displayed anymore (display_time)
+ * in case picture that should not be displayed anymore (display_time)
* overlap with a picture to be displayed (p_current->i_start) */
if( !b_late && !p_current->b_ephemer )
start_date = p_current->i_start;
return p_subpic;
}
+void spu_OffsetSubtitleDate( spu_t *p_spu, mtime_t i_duration )
+{
+ spu_private_t *p_sys = p_spu->p;
+
+ vlc_mutex_lock( &p_sys->lock );
+ for( int i = 0; i < VOUT_MAX_SUBPICTURES; i++ )
+ {
+ spu_heap_entry_t *p_entry = &p_sys->heap.p_entry[i];
+ subpicture_t *p_current = p_entry->p_subpicture;
+
+ if( p_current && p_current->b_subtitle )
+ {
+ if( p_current->i_start > 0 )
+ p_current->i_start += i_duration;
+ if( p_current->i_stop > 0 )
+ p_current->i_stop += i_duration;
+ }
+ }
+ vlc_mutex_unlock( &p_sys->lock );
+}
+
/*****************************************************************************
* subpicture_t allocation
*****************************************************************************/
return i0 < i1 ? -1 : i0 > i1 ? 1 : 0;
}
/**
- * This function compares 2 subpictures using the following properties
+ * This function compares 2 subpictures using the following properties
* (ordered by priority)
* 1. absolute positionning
* 2. start time