[trunk] move to the new API for function opj_stream_destroy. Use now opj_stream_destroy_v3 (WIP)
This commit is contained in:
parent
c03ca9c73c
commit
4bf4a7668e
|
@ -1806,7 +1806,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
default:
|
||||
fprintf(stderr, "skipping file..\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1828,7 +1828,7 @@ int main(int argc, char **argv) {
|
|||
fout = fopen(parameters.outfile, "wb");
|
||||
if (! fout) {
|
||||
fprintf(stderr, "Not enable to create output file!\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1852,7 +1852,7 @@ int main(int argc, char **argv) {
|
|||
for (i=0;i<l_nb_tiles;++i) {
|
||||
if (! opj_write_tile(l_codec,i,l_data,l_data_size,l_stream)) {
|
||||
fprintf(stderr, "ERROR -> test_tile_encoder: failed to write the tile %d!\n",i);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fout);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
|
@ -1873,7 +1873,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
if (!bSuccess) {
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fout);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
|
@ -1883,7 +1883,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
fprintf(stderr,"Generated outfile %s\n",parameters.outfile);
|
||||
/* close and free the byte stream */
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fout);
|
||||
|
||||
/* free remaining compression structures */
|
||||
|
|
|
@ -783,7 +783,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
default:
|
||||
fprintf(stderr, "skipping file..\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -795,7 +795,7 @@ int main(int argc, char **argv)
|
|||
/* Setup the decoder decoding parameters using user parameters */
|
||||
if ( !opj_setup_decoder(l_codec, ¶meters) ){
|
||||
fprintf(stderr, "ERROR -> j2k_dump: failed to setup the decoder\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(l_codec);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -805,7 +805,7 @@ int main(int argc, char **argv)
|
|||
/* Read the main header of the codestream and if necessary the JP2 boxes*/
|
||||
if(! opj_read_header(l_stream, l_codec, &image)){
|
||||
fprintf(stderr, "ERROR -> opj_decompress: failed to read the header\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
|
@ -817,7 +817,7 @@ int main(int argc, char **argv)
|
|||
if (!opj_set_decode_area(l_codec, image, parameters.DA_x0,
|
||||
parameters.DA_y0, parameters.DA_x1, parameters.DA_y1)){
|
||||
fprintf(stderr, "ERROR -> opj_decompress: failed to set the decoded area\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
fclose(fsrc);
|
||||
|
@ -828,7 +828,7 @@ int main(int argc, char **argv)
|
|||
if (!(opj_decode(l_codec, l_stream, image) && opj_end_decompress(l_codec, l_stream))) {
|
||||
fprintf(stderr,"ERROR -> opj_decompress: failed to decode image!\n");
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_image_destroy(image);
|
||||
fclose(fsrc);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -840,7 +840,7 @@ int main(int argc, char **argv)
|
|||
/*if (!opj_set_decoded_resolution_factor(l_codec, 5)) {
|
||||
fprintf(stderr, "ERROR -> opj_decompress: failed to set the resolution factor tile!\n");
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_image_destroy(image);
|
||||
fclose(fsrc);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -849,7 +849,7 @@ int main(int argc, char **argv)
|
|||
if (!opj_get_decoded_tile(l_codec, l_stream, image, parameters.tile_index)) {
|
||||
fprintf(stderr, "ERROR -> opj_decompress: failed to decode tile!\n");
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_image_destroy(image);
|
||||
fclose(fsrc);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -858,7 +858,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
/* Close the byte stream */
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fsrc);
|
||||
|
||||
if(image->color_space == OPJ_CLRSPC_SYCC){
|
||||
|
|
|
@ -523,7 +523,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
default:
|
||||
fprintf(stderr, "skipping file..\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -535,7 +535,7 @@ int main(int argc, char *argv[])
|
|||
/* Setup the decoder decoding parameters using user parameters */
|
||||
if ( !opj_setup_decoder(l_codec, ¶meters) ){
|
||||
fprintf(stderr, "ERROR -> opj_dump: failed to setup the decoder\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(l_codec);
|
||||
fclose(fout);
|
||||
|
@ -545,7 +545,7 @@ int main(int argc, char *argv[])
|
|||
/* Read the main header of the codestream and if necessary the JP2 boxes*/
|
||||
if(! opj_read_header(l_stream, l_codec, &image)){
|
||||
fprintf(stderr, "ERROR -> opj_dump: failed to read the header\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
|
@ -560,7 +560,7 @@ int main(int argc, char *argv[])
|
|||
cstr_index = opj_get_cstr_index(l_codec);
|
||||
|
||||
/* close the byte stream */
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fsrc);
|
||||
|
||||
/* free remaining structures */
|
||||
|
|
|
@ -228,7 +228,7 @@ int main(int argc, char **argv)
|
|||
/* Setup the decoder decoding parameters using user parameters */
|
||||
if ( !opj_setup_decoder(l_codec, ¶meters) ){
|
||||
fprintf(stderr, "ERROR -> j2k_dump: failed to setup the decoder\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(l_codec);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -237,7 +237,7 @@ int main(int argc, char **argv)
|
|||
/* Read the main header of the codestream and if necessary the JP2 boxes*/
|
||||
if(! opj_read_header(l_stream, l_codec, &image)){
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to read the header\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
|
@ -258,7 +258,7 @@ int main(int argc, char **argv)
|
|||
fprintf(stdout, "Decoding tile %d ...\n", tile_index); \
|
||||
if(!opj_get_decoded_tile(l_codec, l_stream, image, tile_index )){ \
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode tile %d\n", tile_index); \
|
||||
opj_stream_destroy(l_stream); \
|
||||
opj_stream_destroy_v3(l_stream); \
|
||||
opj_destroy_cstr_info(&cstr_info); \
|
||||
opj_destroy_codec(l_codec); \
|
||||
opj_image_destroy(image); \
|
||||
|
@ -268,7 +268,7 @@ int main(int argc, char **argv)
|
|||
for(index = 0; index < image->numcomps; ++index) { \
|
||||
if( image->comps[index].data == NULL ){ \
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode tile %d\n", tile_index); \
|
||||
opj_stream_destroy(l_stream); \
|
||||
opj_stream_destroy_v3(l_stream); \
|
||||
opj_destroy_cstr_info(&cstr_info); \
|
||||
opj_destroy_codec(l_codec); \
|
||||
opj_image_destroy(image); \
|
||||
|
@ -286,7 +286,7 @@ int main(int argc, char **argv)
|
|||
TEST_TILE(tile_lr)
|
||||
|
||||
/* Close the byte stream */
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
|
||||
/* Destroy code stream info */
|
||||
opj_destroy_cstr_info(&cstr_info);
|
||||
|
|
|
@ -270,7 +270,7 @@ int main (int argc, char *argv[])
|
|||
fprintf(stderr, "ERROR -> Not a valid JPEG2000 file!\n");
|
||||
fclose(l_file);
|
||||
free(l_data);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ int main (int argc, char *argv[])
|
|||
fprintf(stderr, "ERROR -> j2k_dump: failed to setup the decoder\n");
|
||||
fclose(l_file);
|
||||
free(l_data);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ int main (int argc, char *argv[])
|
|||
fprintf(stderr, "ERROR -> j2k_to_image: failed to read the header\n");
|
||||
fclose(l_file);
|
||||
free(l_data);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ int main (int argc, char *argv[])
|
|||
fprintf(stderr, "ERROR -> j2k_to_image: failed to set the decoded area\n");
|
||||
fclose(l_file);
|
||||
free(l_data);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(l_image);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -328,7 +328,7 @@ int main (int argc, char *argv[])
|
|||
{
|
||||
fclose(l_file);
|
||||
free(l_data);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(l_image);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -343,7 +343,7 @@ int main (int argc, char *argv[])
|
|||
{
|
||||
fclose(l_file);
|
||||
free(l_new_data);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(l_image);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -356,7 +356,7 @@ int main (int argc, char *argv[])
|
|||
{
|
||||
fclose(l_file);
|
||||
free(l_data);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(l_image);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -369,7 +369,7 @@ int main (int argc, char *argv[])
|
|||
{
|
||||
fclose(l_file);
|
||||
free(l_data);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(l_image);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -378,7 +378,7 @@ int main (int argc, char *argv[])
|
|||
/* Free memory */
|
||||
fclose(l_file);
|
||||
free(l_data);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(l_image);
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ int main (int argc, char *argv[])
|
|||
|
||||
if (! opj_start_compress(l_codec,l_image,l_stream)) {
|
||||
fprintf(stderr, "ERROR -> test_tile_encoder: failed to start compress!\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(l_file);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(l_image);
|
||||
|
@ -300,7 +300,7 @@ int main (int argc, char *argv[])
|
|||
for (i=0;i<l_nb_tiles;++i) {
|
||||
if (! opj_write_tile(l_codec,i,l_data,l_data_size,l_stream)) {
|
||||
fprintf(stderr, "ERROR -> test_tile_encoder: failed to write the tile %d!\n",i);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(l_file);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(l_image);
|
||||
|
@ -310,14 +310,14 @@ int main (int argc, char *argv[])
|
|||
|
||||
if (! opj_end_compress(l_codec,l_stream)) {
|
||||
fprintf(stderr, "ERROR -> test_tile_encoder: failed to end compress!\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(l_file);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(l_image);
|
||||
return 1;
|
||||
}
|
||||
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(l_file);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(l_image);
|
||||
|
|
|
@ -99,9 +99,9 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_info_handler(l_codec, info_callback,00);
|
||||
opj_set_warning_handler(l_codec, warning_callback,00);
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_info_handler(l_codec, info_callback,00);
|
||||
opj_set_warning_handler(l_codec, warning_callback,00);
|
||||
opj_set_error_handler(l_codec, error_callback,00);
|
||||
|
||||
l_codec = opj_create_compress(OPJ_CODEC_J2K);
|
||||
|
@ -125,7 +125,7 @@ int main(int argc, char *argv[])
|
|||
bSuccess = opj_end_compress(l_codec, l_stream);
|
||||
assert( bSuccess );
|
||||
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(f);
|
||||
|
||||
opj_destroy_codec(l_codec);
|
||||
|
|
|
@ -101,9 +101,9 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_info_handler(l_codec, info_callback,00);
|
||||
opj_set_warning_handler(l_codec, warning_callback,00);
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_info_handler(l_codec, info_callback,00);
|
||||
opj_set_warning_handler(l_codec, warning_callback,00);
|
||||
opj_set_error_handler(l_codec, error_callback,00);
|
||||
|
||||
l_codec = opj_create_compress(OPJ_CODEC_J2K);
|
||||
|
@ -127,7 +127,7 @@ int main(int argc, char *argv[])
|
|||
bSuccess = opj_end_compress(l_codec, l_stream);
|
||||
assert( bSuccess );
|
||||
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(f);
|
||||
|
||||
opj_destroy_codec(l_codec);
|
||||
|
@ -161,7 +161,7 @@ int main(int argc, char *argv[])
|
|||
bSuccess = opj_end_decompress(l_codec, l_stream);
|
||||
assert( bSuccess );
|
||||
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_stream_destroy_v3(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(d_codec);
|
||||
|
||||
|
|
Loading…
Reference in New Issue