Typical processing for subtitles: [module (capability, category, subcategory)]
[demuxer (demux, CAT_INPUT, SUBCAT_INPUT_DEMUX)]
↓
[es_output]
↓
[codec (decoder, CAT_INPUT, SUBCAT_INPUT_SCODEC)]
↓
[vout_subpictures]
↓ ↓
↓ [text_renderer (text_renderer, CAT_VIDEO, SUBCAT_VIDEO_SUBPIC)]
↓ ↓
[video_output]
Demuxer parses stream (video file, text file, etc) and sends subtitles data block to decoder.
- Initialize and Add ES to send subtitles data block to decoder.
Code: Select all
es_format_Init( &fmt, SPU_ES, VLC_CODEC_*** );
/* */
p_sys->es = es_out_Add( p_demux->out, &fmt );
- Parse stream and generate subtitles data block.
data block (block_t) has time related information (block_t->i_pts, block_t->i_length).
- Send subtitles data block to decoder.
Code: Select all
es_out_Send( p_demux->out, p_sys->es, p_block );
Decoder receives subtitles data block and sends subpicture data.
- Check codec type.
Code: Select all
if( p_dec->fmt_in.i_codec != VLC_CODEC_*** )
return VLC_EGENERIC;
- Parse data block and generate text or image subpicture data.
If the subpicture data is text based, the character encoding of the text must be converted to UTF-8.
Subpicture data(subpicture_t) has also time related information (subpicture_t->i_start, subpicutre_t->i_stop), and these variables are set from data block like tihs:
Code: Select all
p_spu->i_start = p_block->i_pts;
p_spu->i_stop = p_block->i_pts + p_block->i_length;
How To Ask Questions The Smart Way http://www.catb.org/~esr/faqs/smart-questions.html
My hack for ISDB-T http://sdrv.ms/126weue