[vlc-devel] [PATCH 1/2] demux/subtitles: add new implementation for line-peeking

Filip Roséen filip at atch.se
Mon Nov 7 18:56:01 CET 2016


Hi Rémi,

On 2016-11-07 19:47, Rémi Denis-Courmont wrote:

> No, you can´t: The offset needs to be stored somewhere if you peek more than 
> one line. Indeed, the current code has it, your patch and it, and my wrapper 
> has it.

I would not have said that it was possible if I did not see ways of
implementing it.

One, of actually quite a few, ways of implementing this would be to
utilize the `block_t::p_next` of `stream_priv_t::p_peek` in order to
store the associated state required.

The above is easiest to explain in a short period of time (given that
I am very hungry and on my way to buy food), but I can list more
possibilities for you if such is requested.

> You also need to store some state associated with character encoding 
> conversion one way or another. Or from a high level point of view, peeking 
> lines should not affect the underlying stream state for later demuxers in the 
> probing sequence.
 
It would not change the underlying stream state for later demuxers as
BOM probing happens when `vlc_stream_ReadLine` is invoked for a stream
currently at offset `0` (which is bad if you know that you'd like to
see to offset `N` in a file with *BOM*, given still have to consume
the first line via `vlc_stream_ReadLine` - that is however both
trivial to fix, and off-topic).

Best Regards,\
Filip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161107/b6e54be6/attachment.html>


More information about the vlc-devel mailing list