<p dir="ltr">Thanks, guys. Your answers helped and I think I have some ideas now on what to do.</p>
</br></br><div class="device_aol_et_org_dt_dd_quote"></div><hr style="border:0;height:1px;color:#999;background-color:#999;width:100%;margin:0 0 9px 0;padding:0;"></hr><span style="font-size:14px; color:#999999;">On Wednesday, March 6, 2019 Miroslav Lichvar <<span style="color:#0000A0">mlichvar@redhat.com</span>> wrote:</span><br></br><html><body>On Tue, Mar 05, 2019 at 10:26:54PM -0800, Brian Willoughby wrote:<br clear="none">> Frames start with a 14-bit sync code, which is 13 “one" bits and 1 “zero" bit. Subframes start with a 1-bit padding of “zero." Keep in mind that FLAC is a bit stream, not a byte stream, so that 14-bit frame sync can happen anywhere in a pair of bytes. You can’t simply scan memory bytes for a frame sync, at least not unless you allow for 8 variations, apply bit masks, and allow for non-word-address-aligned matches.<br clear="none"><br clear="none">The specification says frames are aligned to bytes:<br clear="none"><br clear="none">    Following the frame header are encoded subframes, one for each<br clear="none">    channel, and finally, the frame is zero-padded to a byte boundary.<br clear="none"><br clear="none">The problem with finding frame boundaries is that the sync code and<br clear="none">the 8-bit CRC are too short, so the whole frame needs to be parsed<br clear="none">and the 16-bit CRC checked to be reasonably sure it really is a FLAC<div class="yqt2054816578" id="yqtfd90164"><br clear="none">frame.</div><br clear="none"><br clear="none">-- <br clear="none">Miroslav Lichvar<div class="yqt2054816578" id="yqtfd80190"><br clear="none"></div></body></html>