Bug 196 - Added handler for non-error libjeg output.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1595 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2005-11-19 18:35:31 +00:00
parent 8287f722ba
commit b2a7183f12
1 changed files with 11 additions and 5 deletions

View File

@ -119,6 +119,7 @@ bool Image::ReadJpeg( const char *filename )
struct zm_error_mgr jerr; struct zm_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr.pub); cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = zm_jpeg_error_exit; jerr.pub.error_exit = zm_jpeg_error_exit;
jerr.pub.emit_message = zm_jpeg_emit_message;
jpeg_create_decompress(&cinfo); jpeg_create_decompress(&cinfo);
@ -178,8 +179,10 @@ bool Image::WriteJpeg( const char *filename, int quality_override ) const
} }
struct jpeg_compress_struct cinfo; struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr; struct zm_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr); cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = zm_jpeg_error_exit;
jerr.pub.emit_message = zm_jpeg_emit_message;
jpeg_create_compress(&cinfo); jpeg_create_compress(&cinfo);
FILE *outfile; FILE *outfile;
@ -230,6 +233,7 @@ bool Image::DecodeJpeg( JOCTET *inbuffer, int inbuffer_size )
struct zm_error_mgr jerr; struct zm_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr.pub); cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = zm_jpeg_error_exit; jerr.pub.error_exit = zm_jpeg_error_exit;
jerr.pub.emit_message = zm_jpeg_emit_message;
jpeg_create_decompress(&cinfo); jpeg_create_decompress(&cinfo);
@ -275,12 +279,14 @@ bool Image::EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size, int quality_over
{ {
Image temp_image( *this ); Image temp_image( *this );
temp_image.Colourise(); temp_image.Colourise();
return( temp_image.EncodeJpeg( outbuffer, outbuffer_size ) ); return( temp_image.EncodeJpeg( outbuffer, outbuffer_size, quality_override ) );
} }
struct jpeg_compress_struct cinfo; struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr; struct zm_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr); cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = zm_jpeg_error_exit;
jerr.pub.emit_message = zm_jpeg_emit_message;
jpeg_create_compress(&cinfo); jpeg_create_compress(&cinfo);
jpeg_mem_dest(&cinfo, outbuffer, outbuffer_size ); jpeg_mem_dest(&cinfo, outbuffer, outbuffer_size );