OPJ_BOOL OPJ_CALLCONV opj_read_header(opj_stream_t *p_stream,
                                      opj_codec_t *p_codec,
                                      opj_image_t **p_image)
{
    if (p_codec && p_stream) {
        opj_codec_private_t* l_codec = (opj_codec_private_t*) p_codec;
        opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;

        if (! l_codec->is_decompressor) {
            opj_event_msg(&(l_codec->m_event_mgr), EVT_ERROR,
                          "Codec provided to the opj_read_header function is not a decompressor handler.\n");
            return OPJ_FALSE;
        }

        return l_codec->m_codec_data.m_decompression.opj_read_header(l_stream,
                l_codec->m_codec,
                p_image,
                &(l_codec->m_event_mgr));
    }

    return OPJ_FALSE;
}
OPJ_BOOL OPJ_CALLCONV opj_read_header(opj_stream_t *p_stream,
                                      opj_codec_t *p_codec,
                                      opj_image_t **p_image)
{
    if (p_codec && p_stream) {
        opj_codec_private_t* l_codec = (opj_codec_private_t*) p_codec;
        opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;

        if (! l_codec->is_decompressor) {
            opj_event_msg(&(l_codec->m_event_mgr), EVT_ERROR,
                          "Codec provided to the opj_read_header function is not a decompressor handler.\n");
            return OPJ_FALSE;
        }

        return l_codec->m_codec_data.m_decompression.opj_read_header(l_stream,
                l_codec->m_codec,
                p_image,
                &(l_codec->m_event_mgr));
    }

    return OPJ_FALSE;
}