<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<p>Hi Rémi,</p>
<p>On 2016-11-07 19:47, Rémi Denis-Courmont wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> 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.</code></pre>
</blockquote>
<p>I would not have said that it was possible if I did not see ways of implementing it.</p>
<p>One, of actually quite a few, ways of implementing this would be to utilize the <code>block_t::p_next</code> of <code>stream_priv_t::p_peek</code> in order to store the associated state required.</p>
<p>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.</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> 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.</code></pre>
</blockquote>
<p>It would not change the underlying stream state for later demuxers as BOM probing happens when <code>vlc_stream_ReadLine</code> is invoked for a stream currently at offset <code>0</code> (which is bad if you know that you’d like to see to offset <code>N</code> in a file with <em>BOM</em>, given still have to consume the first line via <code>vlc_stream_ReadLine</code> - that is however both trivial to fix, and off-topic).</p>
<p>Best Regards,<br />
Filip</p>
</body>
</html>