[vlc-devel] [vlc-commits] Add NTSC EIA-608 caption rendering support via V4L2 VBI devices

Devin Heitmueller dheitmueller at kernellabs.com
Sat Dec 15 21:05:20 CET 2012


Sorry for the delay in responding to this.

On Thu, Dec 13, 2012 at 5:28 AM, Rafaël Carré <funman at videolan.org> wrote:
> +    {
> +        for (int i = 0; i < num_streams; i++)
> +        {
> +            block_t *p_sblock;
> +            if (p_es_subt[i] == NULL)
> +                continue;
> +            p_sblock = block_Duplicate(p_block);
> +            if (p_sblock)
> +                es_out_Send(p_demux->out, p_es_subt[i], p_sblock);
> +        }
> +        block_Release(p_block);
>
> num_streams = VBI_NUM_CC_STREAMS = 4
>
> But you will just duplicate the same information 4 times.
>
> Why duplicating at all?

This is a result of the way the EIA-608 decoder in VLC expects to get
the data (i.e. modules/codec/cc.c).  One instance of the decoder gets
created for each of the four possible CC streams.  However the decoder
is written such that it receives the entire block of VBI data for all
streams and it picks out the parts relevant to the target stream it is
associated with (based on the VLC_FOURCC code specified at
instantiation).  I can only assume it was done this way so that the
caller doesn't have to take responsibility for parsing through the VBI
bytes and figuring out which bytes should be sent to which stream.

None of this was a result of the work done in my patch - it was all
pre-existing code - and in fact if I recall I copied the original code
from src/input/decoder.c (function DecoderGetCc).

I'm not going to argue that this probably wasn't the best approach,
and in fact isn't how I would have designed it.  That said, it was
outside of my scope to refactor the existing code and all the callers
to clean it up.  My goal was to bolt in the support for VBI via V4L,
using the existing frameworks and conventions.

Cheers,

Devin

--
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com



More information about the vlc-devel mailing list