/// <summary> /// Install a special processing method for COM or APPn markers. /// </summary> public void jpeg_set_marker_processor(int marker_code, jpeg_decompress_struct.jpeg_marker_parser_method routine) { if (marker_code == (int)JPEG_MARKER.COM) { m_process_COM = routine; } else if (marker_code >= (int)JPEG_MARKER.APP0 && marker_code <= (int)JPEG_MARKER.APP15) { m_process_APPn[marker_code - (int)JPEG_MARKER.APP0] = routine; } else { m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_UNKNOWN_MARKER, marker_code); } }
public void jpeg_save_markers(int marker_code, int length_limit) { /* Choose processor routine to use. * APP0/APP14 have special requirements. */ jpeg_decompress_struct.jpeg_marker_parser_method processor; if (length_limit != 0) { processor = save_marker; /* If saving APP0/APP14, save at least enough for our internal use. */ if (marker_code == (int)JPEG_MARKER.APP0 && length_limit < APP0_DATA_LEN) { length_limit = APP0_DATA_LEN; } else if (marker_code == (int)JPEG_MARKER.APP14 && length_limit < APP14_DATA_LEN) { length_limit = APP14_DATA_LEN; } } else { processor = skip_variable; /* If discarding APP0/APP14, use our regular on-the-fly processor. */ if (marker_code == (int)JPEG_MARKER.APP0 || marker_code == (int)JPEG_MARKER.APP14) { processor = get_interesting_appn; } } if (marker_code == (int)JPEG_MARKER.COM) { m_process_COM = processor; m_length_limit_COM = length_limit; } else if (marker_code >= (int)JPEG_MARKER.APP0 && marker_code <= (int)JPEG_MARKER.APP15) { m_process_APPn[marker_code - (int)JPEG_MARKER.APP0] = processor; m_length_limit_APPn[marker_code - (int)JPEG_MARKER.APP0] = length_limit; } else { m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_UNKNOWN_MARKER, marker_code); } }
private int m_bytes_read; /* data bytes read so far in marker */ /* Note: cur_marker is not linked into marker_list until it's all read. */ /// <summary> /// Initialize the marker reader module. /// This is called only once, when the decompression object is created. /// </summary> public jpeg_marker_reader(jpeg_decompress_struct cinfo) { m_cinfo = cinfo; /* Initialize COM/APPn processing. * By default, we examine and then discard APP0 and APP14, * but simply discard COM and all other APPn. */ m_process_COM = skip_variable; for (int i = 0; i < 16; i++) { m_process_APPn[i] = skip_variable; m_length_limit_APPn[i] = 0; } m_process_APPn[0] = get_interesting_appn; m_process_APPn[14] = get_interesting_appn; /* Reset marker processing state */ reset_marker_reader(); }
public void jpeg_save_markers(int marker_code, int length_limit) { /* Choose processor routine to use. * APP0/APP14 have special requirements. */ jpeg_decompress_struct.jpeg_marker_parser_method processor; if (length_limit != 0) { processor = save_marker; /* If saving APP0/APP14, save at least enough for our internal use. */ if (marker_code == (int)JPEG_MARKER.APP0 && length_limit < APP0_DATA_LEN) length_limit = APP0_DATA_LEN; else if (marker_code == (int)JPEG_MARKER.APP14 && length_limit < APP14_DATA_LEN) length_limit = APP14_DATA_LEN; } else { processor = skip_variable; /* If discarding APP0/APP14, use our regular on-the-fly processor. */ if (marker_code == (int)JPEG_MARKER.APP0 || marker_code == (int)JPEG_MARKER.APP14) processor = get_interesting_appn; } if (marker_code == (int)JPEG_MARKER.COM) { m_process_COM = processor; m_length_limit_COM = length_limit; } else if (marker_code >= (int)JPEG_MARKER.APP0 && marker_code <= (int)JPEG_MARKER.APP15) { m_process_APPn[marker_code - (int)JPEG_MARKER.APP0] = processor; m_length_limit_APPn[marker_code - (int)JPEG_MARKER.APP0] = length_limit; } else m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_UNKNOWN_MARKER, marker_code); }
/// <summary> /// Install a special processing method for COM or APPn markers. /// </summary> public void jpeg_set_marker_processor(int marker_code, jpeg_decompress_struct.jpeg_marker_parser_method routine) { if (marker_code == (int)JPEG_MARKER.COM) m_process_COM = routine; else if (marker_code >= (int)JPEG_MARKER.APP0 && marker_code <= (int)JPEG_MARKER.APP15) m_process_APPn[marker_code - (int)JPEG_MARKER.APP0] = routine; else m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_UNKNOWN_MARKER, marker_code); }
/* Install a special processing method for COM or APPn markers. */ public void SetMarkerProcessor(int markerCode, MarkerParser routine) { jpeg_decompress_struct.jpeg_marker_parser_method f = delegate { return(routine(this)); }; m_decompressor.jpeg_set_marker_processor(markerCode, f); }