/* Write datastream header. This consists of an SOI and optional APPn markers. We recommend use of the JFIF marker, but not the Adobe marker, when using YCbCr or grayscale data. The JFIF marker should NOT be used for any other JPEG colorspace. The Adobe marker is helpful to distinguish RGB, CMYK, and YCCK colorspaces. Note that an application can write additional header markers after jpeg_start_compress returns.  */
write_file_header(j_compress_ptr cinfo)
/* Write datastream header. This consists of an SOI and optional APPn markers. We recommend use of the JFIF marker, but not the Adobe marker, when using YCbCr or grayscale data. The JFIF marker should NOT be used for any other JPEG colorspace. The Adobe marker is helpful to distinguish RGB, CMYK, and YCCK colorspaces. Note that an application can write additional header markers after jpeg_start_compress returns.  */
write_file_header(j_compress_ptr cinfo)
{
    my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
    emit_marker(cinfo, M_SOI);
    marker->last_restart_interval = 0;
    if (cinfo->write_JFIF_header)
        emit_jfif_app0(cinfo);
    if (cinfo->write_Adobe_marker)
        emit_adobe_app14(cinfo);
}