BitMiracle.LibJpeg.Classic.Internal.jpeg_marker_reader.first_marker C# (CSharp) Method

first_marker() private method

Like next_marker, but used to obtain the initial SOI marker. For this marker, we do not allow preceding garbage or fill; otherwise, we might well scan an entire input file before realizing it ain't JPEG. If an application wants to process non-JFIF files, it must seek to the SOI before calling the JPEG library.
private first_marker ( ) : bool
return bool
        private bool first_marker()
        {
            int c;
            if (!m_cinfo.m_src.GetByte(out c))
                return false;

            int c2;
            if (!m_cinfo.m_src.GetByte(out c2))
                return false;

            if (c != 0xFF || c2 != (int)JPEG_MARKER.SOI)
                m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_NO_SOI, c, c2);

            m_cinfo.m_unread_marker = c2;
            return true;
        }
    }