#include <string.h> /* strerror() */
#include <vlc/vlc.h>
-
-#include "vlc_block.h"
-#include "vlc_video.h"
-#include "video_output.h"
-#include "vlc_spu.h"
-#include "vlc_filter.h"
+#include <vlc_vout.h>
+#include <vlc_block.h>
+#include <vlc_filter.h>
+#include <vlc_osd.h>
/*****************************************************************************
* Local prototypes
*/
int spu_Init( spu_t *p_spu )
{
- char *psz_filter, *psz_filter_orig;
+ char *psz_parser;
vlc_value_t val;
/* If the user requested a sub margin, we force the position. */
var_Create( p_spu, "sub-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_spu, "sub-filter", &val );
- psz_filter = psz_filter_orig = val.psz_string;
- while( psz_filter && *psz_filter )
+
+ psz_parser = val.psz_string;
+
+ while( psz_parser && *psz_parser )
{
- char *psz_parser = strchr( psz_filter, ':' );
+ config_chain_t *p_cfg; /* Do we ever need to free this ? */
+ char *psz_name;
+
+ psz_parser = config_ChainCreate( &psz_name, &p_cfg, psz_parser );
- if( psz_parser ) *psz_parser++ = 0;
+ msg_Dbg( p_spu, "adding sub-filter: %s", psz_name );
p_spu->pp_filter[p_spu->i_filter] =
vlc_object_create( p_spu, VLC_OBJECT_FILTER );
vlc_object_attach( p_spu->pp_filter[p_spu->i_filter], p_spu );
p_spu->pp_filter[p_spu->i_filter]->pf_sub_buffer_new = sub_new_buffer;
p_spu->pp_filter[p_spu->i_filter]->pf_sub_buffer_del = sub_del_buffer;
+ p_spu->pp_filter[p_spu->i_filter]->p_cfg = p_cfg;;
p_spu->pp_filter[p_spu->i_filter]->p_module =
module_Need( p_spu->pp_filter[p_spu->i_filter],
- "sub filter", psz_filter, 0 );
+ "sub filter", psz_name, 0 );
if( p_spu->pp_filter[p_spu->i_filter]->p_module )
{
filter_owner_sys_t *p_sys = malloc( sizeof(filter_owner_sys_t) );
msg_Dbg( p_spu, "can't add anymore filters" );
}
- psz_filter = psz_parser;
+ free( psz_name );
}
- if( psz_filter_orig ) free( psz_filter_orig );
+ if( val.psz_string ) free( val.psz_string );
return VLC_EGENERIC;
}
p_region->picture.pf_release( &p_region->picture );
if( p_region->fmt.p_palette ) free( p_region->fmt.p_palette );
if( p_region->p_cache ) __spu_DestroyRegion( p_this, p_region->p_cache );
+
+ if( p_region->psz_text )
+ free( p_region->psz_text );
+ //free( p_region->p_style ); FIXME --fenrir plugin does not allocate the memory for it. I think it might lead to segfault, video renderer can live longer than the decoder
free( p_region );
}
memset( p_subpic, 0, sizeof(subpicture_t) );
p_subpic->i_status = RESERVED_SUBPICTURE;
p_subpic->b_absolute = VLC_TRUE;
+ p_subpic->b_pausable = VLC_FALSE;
p_subpic->b_fade = VLC_FALSE;
p_subpic->i_alpha = 0xFF;
p_subpic->p_region = 0;
p_subpic->pf_create_region = __spu_CreateRegion;
p_subpic->pf_make_region = __spu_MakeRegion;
p_subpic->pf_destroy_region = __spu_DestroyRegion;
-
+
return p_subpic;
}
}
/* Load the text rendering module */
- if( !p_spu->p_text && p_region )
+ if( !p_spu->p_text && p_region && p_region->fmt.i_chroma == VLC_FOURCC('T','E','X','T') )
{
char *psz_modulename = NULL;
}
if( psz_modulename ) free( psz_modulename );
}
- else if( p_region )
+ if( p_spu->p_text )
{
if( p_subpic->i_original_picture_height > 0 &&
p_subpic->i_original_picture_width > 0 )
if( p_region->fmt.i_chroma == VLC_FOURCC('T','E','X','T') )
{
- if( p_spu->p_text && p_spu->p_text->p_module &&
- p_spu->p_text->pf_render_text )
- {/*
- if( p_region->p_style )
- p_region->p_style->i_text_align = p_subpic->i_flags & 0x3; */
- p_spu->p_text->pf_render_text( p_spu->p_text,
- p_region, p_region );
+ if( p_spu->p_text && p_spu->p_text->p_module )
+ {
+ p_region->i_align = p_subpic->i_flags;
+
+ if( p_spu->p_text->pf_render_html && p_region->psz_html )
+ {
+ p_spu->p_text->pf_render_html( p_spu->p_text,
+ p_region, p_region );
+ }
+ else if( p_spu->p_text->pf_render_text )
+ {
+ p_spu->p_text->pf_render_text( p_spu->p_text,
+ p_region, p_region );
+ }
}
}
p_subpic->i_y * i_scale_height / 1000;
}
+
+ i_x_offset = __MAX( i_x_offset, 0 );
+ i_y_offset = __MAX( i_y_offset, 0 );
if( p_spu->i_margin != 0 && p_spu->b_force_crop == VLC_FALSE )
{
}
}
+ i_x_offset = __MAX( i_x_offset, 0 );
+ i_y_offset = __MAX( i_y_offset, 0 );
+
p_spu->p_blend->pf_video_blend( p_spu->p_blend, p_pic_dst,
p_pic_src, &p_region->picture, i_x_offset, i_y_offset,
i_fade_alpha * p_subpic->i_alpha / 255 );
* to be removed if a newer one is available), which makes it a lot
* more difficult to guess if a subpicture has to be rendered or not.
*****************************************************************************/
-subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date )
+subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date,
+ vlc_bool_t b_paused )
{
int i_index, i_channel;
subpicture_t *p_subpic = NULL;
if( display_date > p_spu->p_subpicture[i_index].i_stop &&
( !p_spu->p_subpicture[i_index].b_ephemer ||
p_spu->p_subpicture[i_index].i_stop >
- p_spu->p_subpicture[i_index].i_start ) )
+ p_spu->p_subpicture[i_index].i_start ) &&
+ !( p_spu->p_subpicture[i_index].b_pausable &&
+ b_paused ) )
{
/* Too late, destroy the subpic */
spu_DestroySubpicture( p_spu, &p_spu->p_subpicture[i_index] );
case SPU_CHANNEL_REGISTER:
pi = (int *)va_arg( args, int * );
if( pi ) *pi = p_spu->i_channel++;
- msg_Dbg( p_spu, "Registering subpicture channel, ID: %i",
- p_spu->i_channel - 1 );
break;
case SPU_CHANNEL_CLEAR: