Bug 195: Added quality override so frame server images are correct quality.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1593 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2005-11-18 17:26:12 +00:00
parent b4d248bdcb
commit aa9004cc75
3 changed files with 7 additions and 7 deletions

View File

@ -194,7 +194,7 @@ bool Event::SendFrameImage( const Image *image, bool alarm_frame )
static int jpg_buffer_size = 0; static int jpg_buffer_size = 0;
static unsigned char jpg_buffer[ZM_MAX_IMAGE_SIZE]; static unsigned char jpg_buffer[ZM_MAX_IMAGE_SIZE];
image->EncodeJpeg( jpg_buffer, &jpg_buffer_size ); image->EncodeJpeg( jpg_buffer, &jpg_buffer_size, config.jpeg_file_quality );
static FrameHeader frame_header; static FrameHeader frame_header;

View File

@ -168,7 +168,7 @@ bool Image::ReadJpeg( const char *filename )
return( true ); return( true );
} }
bool Image::WriteJpeg( const char *filename ) const bool Image::WriteJpeg( const char *filename, int quality_override ) const
{ {
if ( config.colour_jpeg_files && colours == 1 ) if ( config.colour_jpeg_files && colours == 1 )
{ {
@ -204,7 +204,7 @@ bool Image::WriteJpeg( const char *filename ) const
} }
jpeg_set_defaults(&cinfo); jpeg_set_defaults(&cinfo);
cinfo.dct_method = JDCT_FASTEST; cinfo.dct_method = JDCT_FASTEST;
jpeg_set_quality(&cinfo, config.jpeg_file_quality, false); jpeg_set_quality(&cinfo, quality_override?quality_override:config.jpeg_file_quality, false);
jpeg_start_compress(&cinfo, TRUE); jpeg_start_compress(&cinfo, TRUE);
JSAMPROW row_pointer; /* pointer to a single row */ JSAMPROW row_pointer; /* pointer to a single row */
@ -269,7 +269,7 @@ bool Image::DecodeJpeg( JOCTET *inbuffer, int inbuffer_size )
return( true ); return( true );
} }
bool Image::EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size ) const bool Image::EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size, int quality_override ) const
{ {
if ( config.colour_jpeg_files && colours == 1 ) if ( config.colour_jpeg_files && colours == 1 )
{ {
@ -298,7 +298,7 @@ bool Image::EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size ) const
} }
jpeg_set_defaults(&cinfo); jpeg_set_defaults(&cinfo);
cinfo.dct_method = JDCT_FASTEST; cinfo.dct_method = JDCT_FASTEST;
jpeg_set_quality(&cinfo, config.jpeg_image_quality, false); jpeg_set_quality(&cinfo, quality_override?quality_override:config.jpeg_image_quality, false);
jpeg_start_compress(&cinfo, TRUE); jpeg_start_compress(&cinfo, TRUE);
JSAMPROW row_pointer; /* pointer to a single row */ JSAMPROW row_pointer; /* pointer to a single row */

View File

@ -192,9 +192,9 @@ public:
} }
bool ReadJpeg( const char *filename ); bool ReadJpeg( const char *filename );
bool WriteJpeg( const char *filename ) const; bool WriteJpeg( const char *filename, int quality_override=0 ) const;
bool DecodeJpeg( JOCTET *inbuffer, int inbuffer_size ); bool DecodeJpeg( JOCTET *inbuffer, int inbuffer_size );
bool EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size ) const; bool EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size, int quality_override=0 ) const;
void Overlay( const Image &image ); void Overlay( const Image &image );
void Blend( const Image &image, int transparency=10 ) const; void Blend( const Image &image, int transparency=10 ) const;