[trunk] remove deprecated v1 style function opj_encode and opj_encode_with_info

This commit is contained in:
Mickael Savinaud 2012-08-09 12:40:22 +00:00
parent 6767ea2456
commit 7b88544d46
2 changed files with 37 additions and 79 deletions

View File

@ -637,42 +637,6 @@ void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *paramete
}
}
/**
* Helper function.
* Sets the stream to be a file stream. The FILE must have been open previously.
* @param p_stream the stream to modify
* @param p_file handler to an already open file.
*/
opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream (FILE * p_file, opj_bool p_is_read_stream)
{
return opj_stream_create_file_stream(p_file,J2K_STREAM_CHUNK_SIZE,p_is_read_stream);
}
opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream ( FILE * p_file,
OPJ_SIZE_T p_size,
opj_bool p_is_read_stream)
{
opj_stream_t* l_stream = 00;
if (! p_file) {
return NULL;
}
l_stream = opj_stream_create(p_size,p_is_read_stream);
if (! l_stream) {
return NULL;
}
opj_stream_set_user_data(l_stream, p_file);
opj_stream_set_user_data_length(l_stream, opj_get_data_length_from_file(p_file));
opj_stream_set_read_function(l_stream, (opj_stream_read_fn) opj_read_from_file);
opj_stream_set_write_function(l_stream, (opj_stream_write_fn) opj_write_from_file);
opj_stream_set_skip_function(l_stream, (opj_stream_skip_fn) opj_skip_from_file);
opj_stream_set_seek_function(l_stream, (opj_stream_seek_fn) opj_seek_from_file);
return l_stream;
}
opj_bool OPJ_CALLCONV opj_setup_encoder(opj_codec_t *p_codec,
opj_cparameters_t *parameters,
opj_image_t *p_image)
@ -746,31 +710,7 @@ opj_bool OPJ_CALLCONV opj_end_compress (opj_codec_t *p_codec,
}
/* DEPRECATED */
opj_bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) {
if (index != NULL)
opj_event_msg((opj_common_ptr)cinfo, EVT_WARNING, "Set index to NULL when calling the opj_encode function.\n"
"To extract the index, use the opj_encode_with_info() function.\n"
"No index will be generated during this encoding\n");
return opj_encode_with_info(cinfo, cio, image, NULL);
}
/* DEPRECATED */
opj_bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) {
if(cinfo && cio && image) {
switch(cinfo->codec_format) {
case CODEC_J2K:
return j2k_encode((opj_j2k_t*)cinfo->j2k_handle, cio, image, cstr_info);
case CODEC_JP2:
return opj_jp2_encode((opj_jp2_t*)cinfo->jp2_handle, cio, image, cstr_info);
case CODEC_JPT:
case CODEC_UNKNOWN:
default:
break;
}
}
return OPJ_FALSE;
}
/* DEPRECATED */
void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) {
@ -1186,3 +1126,40 @@ opj_bool OPJ_CALLCONV opj_write_tile ( opj_codec_t *p_codec,
return OPJ_FALSE;
}
/* ---------------------------------------------------------------------- */
/**
* Helper function.
* Sets the stream to be a file stream. The FILE must have been open previously.
* @param p_stream the stream to modify
* @param p_file handler to an already open file.
*/
opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream (FILE * p_file, opj_bool p_is_read_stream)
{
return opj_stream_create_file_stream(p_file,J2K_STREAM_CHUNK_SIZE,p_is_read_stream);
}
opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream ( FILE * p_file,
OPJ_SIZE_T p_size,
opj_bool p_is_read_stream)
{
opj_stream_t* l_stream = 00;
if (! p_file) {
return NULL;
}
l_stream = opj_stream_create(p_size,p_is_read_stream);
if (! l_stream) {
return NULL;
}
opj_stream_set_user_data(l_stream, p_file);
opj_stream_set_user_data_length(l_stream, opj_get_data_length_from_file(p_file));
opj_stream_set_read_function(l_stream, (opj_stream_read_fn) opj_read_from_file);
opj_stream_set_write_function(l_stream, (opj_stream_write_fn) opj_write_from_file);
opj_stream_set_skip_function(l_stream, (opj_stream_skip_fn) opj_skip_from_file);
opj_stream_set_seek_function(l_stream, (opj_stream_seek_fn) opj_seek_from_file);
return l_stream;
}

View File

@ -1426,25 +1426,6 @@ OPJ_API opj_bool OPJ_CALLCONV opj_end_compress (opj_codec_t *p_codec,
OPJ_API opj_bool OPJ_CALLCONV opj_encode_v2(opj_codec_t *p_codec,
opj_stream_t *p_stream);
/**
Encode an image into a JPEG-2000 codestream
3@param cinfo compressor handle
@param cio Output buffer stream
@param image Image to encode
@param index Depreacted -> Set to NULL. To extract index, used opj_encode_wci()
@return Returns true if successful, returns false otherwise
*/
DEPRECATED( OPJ_API opj_bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) );
/**
Encode an image into a JPEG-2000 codestream and extract the codestream information
@param cinfo compressor handle
@param cio Output buffer stream
@param image Image to encode
@param cstr_info Codestream information structure if needed afterwards, NULL otherwise
@return Returns true if successful, returns false otherwise
*/
DEPRECATED( OPJ_API opj_bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) );
/**
Destroy Codestream information after compression or decompression