private static bool get_interesting_appn(jpeg_decompress_struct cinfo)
{
int length;
if (!cinfo.m_src.GetTwoBytes(out length))
return false;
length -= 2;
/* get the interesting part of the marker data */
int numtoread = 0;
if (length >= APPN_DATA_LEN)
numtoread = APPN_DATA_LEN;
else if (length > 0)
numtoread = length;
byte[] b = new byte[APPN_DATA_LEN];
for (int i = 0; i < numtoread; i++)
{
int temp = 0;
if (!cinfo.m_src.GetByte(out temp))
return false;
b[i] = (byte)temp;
}
length -= numtoread;
/* process it */
switch ((JPEG_MARKER)cinfo.m_unread_marker)
{
case JPEG_MARKER.APP0:
examine_app0(cinfo, b, numtoread, length);
break;
case JPEG_MARKER.APP14:
examine_app14(cinfo, b, numtoread, length);
break;
default:
/* can't get here unless jpeg_save_markers chooses wrong processor */
cinfo.ERREXIT(J_MESSAGE_CODE.JERR_UNKNOWN_MARKER, cinfo.m_unread_marker);
break;
}
/* skip any remaining data -- could be lots */
if (length > 0)
cinfo.m_src.skip_input_data(length);
return true;
}