From aa9004cc75911e3c20eca3a042d381ddd7ef53b4 Mon Sep 17 00:00:00 2001 From: stan Date: Fri, 18 Nov 2005 17:26:12 +0000 Subject: [PATCH] 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 --- src/zm_event.cpp | 2 +- src/zm_image.cpp | 8 ++++---- src/zm_image.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 243c1b055..763ce94a1 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -194,7 +194,7 @@ bool Event::SendFrameImage( const Image *image, bool alarm_frame ) static int jpg_buffer_size = 0; 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; diff --git a/src/zm_image.cpp b/src/zm_image.cpp index aeaf1845d..76cbd6100 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -168,7 +168,7 @@ bool Image::ReadJpeg( const char *filename ) 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 ) { @@ -204,7 +204,7 @@ bool Image::WriteJpeg( const char *filename ) const } jpeg_set_defaults(&cinfo); 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); JSAMPROW row_pointer; /* pointer to a single row */ @@ -269,7 +269,7 @@ bool Image::DecodeJpeg( JOCTET *inbuffer, int inbuffer_size ) 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 ) { @@ -298,7 +298,7 @@ bool Image::EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size ) const } jpeg_set_defaults(&cinfo); 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); JSAMPROW row_pointer; /* pointer to a single row */ diff --git a/src/zm_image.h b/src/zm_image.h index 23df63bef..03f5c9ec7 100644 --- a/src/zm_image.h +++ b/src/zm_image.h @@ -192,9 +192,9 @@ public: } 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 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 Blend( const Image &image, int transparency=10 ) const;