void filter_chain_SubSource( filter_chain_t *p_chain, mtime_t display_date ) { for( chained_filter_t *f = p_chain->first; f != NULL; f = f->next ) { filter_t *p_filter = &f->filter; subpicture_t *p_subpic = p_filter->pf_sub_source( p_filter, display_date ); /* XXX I find that spu_t cast ugly */ if( p_subpic ) spu_PutSubpicture( (spu_t*)p_chain->p_this, p_subpic ); } }
/** * \brief Show text on the video from a given start date to a given end date * \param p_spu pointer to the subpicture queue the text is to be showed on * \param i_channel Subpicture channel * \param psz_string The text to be shown * \param p_style Pointer to a struct with text style info (it is duplicated) * \param i_flags flags for alignment and such * \param i_hmargin horizontal margin in pixels * \param i_vmargin vertical margin in pixels * \param i_start the time when this string is to appear on the video * \param i_stop the time when this string should stop to be displayed * if this is 0 the string will be shown untill the next string * is about to be shown */ int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel, const char *psz_string, const text_style_t *p_style, int i_flags, int i_hmargin, int i_vmargin, mtime_t i_start, mtime_t i_stop ) { subpicture_t *p_spu; video_format_t fmt; (void)p_style; if( !psz_string ) return VLC_EGENERIC; p_spu = subpicture_New( NULL ); if( !p_spu ) return VLC_EGENERIC; p_spu->i_channel = i_channel; p_spu->i_start = i_start; p_spu->i_stop = i_stop; p_spu->b_ephemer = true; p_spu->b_absolute = false; /* Create a new subpicture region */ memset( &fmt, 0, sizeof(video_format_t) ); fmt.i_chroma = VLC_CODEC_TEXT; fmt.i_width = fmt.i_height = 0; fmt.i_x_offset = fmt.i_y_offset = 0; p_spu->p_region = subpicture_region_New( &fmt ); if( !p_spu->p_region ) { msg_Err( p_spu_channel, "cannot allocate SPU region" ); subpicture_Delete( p_spu ); return VLC_EGENERIC; } p_spu->p_region->psz_text = strdup( psz_string ); p_spu->p_region->i_align = i_flags & SUBPICTURE_ALIGN_MASK; p_spu->p_region->i_x = i_hmargin; p_spu->p_region->i_y = i_vmargin; spu_PutSubpicture( p_spu_channel, p_spu ); return VLC_SUCCESS; }
int transcode_spu_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id, block_t *in, block_t **out ) { sout_stream_sys_t *p_sys = p_stream->p_sys; subpicture_t *p_subpic; *out = NULL; p_subpic = id->p_decoder->pf_decode_sub( id->p_decoder, &in ); if( !p_subpic ) { /* We just don't have anything to handle now, go own*/ return VLC_SUCCESS; } if( p_sys->b_master_sync && p_sys->i_master_drift ) { p_subpic->i_start -= p_sys->i_master_drift; if( p_subpic->i_stop ) p_subpic->i_stop -= p_sys->i_master_drift; } if( p_sys->b_soverlay ) { spu_PutSubpicture( p_sys->p_spu, p_subpic ); return VLC_SUCCESS; } else { block_t *p_block; p_block = id->p_encoder->pf_encode_sub( id->p_encoder, p_subpic ); subpicture_Delete( p_subpic ); if( p_block ) { block_ChainAppend( out, p_block ); return VLC_SUCCESS; } } return VLC_EGENERIC; }
int transcode_spu_process( sout_stream_t *p_stream, sout_stream_id_t *id, block_t *in, block_t **out ) { sout_stream_sys_t *p_sys = p_stream->p_sys; subpicture_t *p_subpic; *out = NULL; p_subpic = id->p_decoder->pf_decode_sub( id->p_decoder, &in ); if( !p_subpic ) return VLC_EGENERIC; sout_UpdateStatistic( p_stream->p_sout, SOUT_STATISTIC_DECODED_SUBTITLE, 1 ); if( p_sys->b_master_sync && p_sys->i_master_drift ) { p_subpic->i_start -= p_sys->i_master_drift; if( p_subpic->i_stop ) p_subpic->i_stop -= p_sys->i_master_drift; } if( p_sys->b_soverlay ) { spu_PutSubpicture( p_sys->p_spu, p_subpic ); } else { block_t *p_block; p_block = id->p_encoder->pf_encode_sub( id->p_encoder, p_subpic ); spu_del_buffer( id->p_decoder, p_subpic ); if( p_block ) { block_ChainAppend( out, p_block ); return VLC_SUCCESS; } } return VLC_EGENERIC; }