ifdef HAVE_ZLIB_H around code that uses Image->Zip

This commit is contained in:
Isaac Connor 2019-05-03 09:04:31 -04:00
parent 75b4f4f2b3
commit fee95c2316
2 changed files with 10 additions and 0 deletions

View File

@ -394,10 +394,15 @@ bool MonitorStream::sendFrame(Image *image, struct timeval *timestamp) {
img_buffer_size = send_image->Size(); img_buffer_size = send_image->Size();
break; break;
case STREAM_ZIP : case STREAM_ZIP :
#if HAVE_ZLIB_H
fputs("Content-Type: image/x-rgbz\r\n",stdout); fputs("Content-Type: image/x-rgbz\r\n",stdout);
unsigned long zip_buffer_size; unsigned long zip_buffer_size;
send_image->Zip(img_buffer, &zip_buffer_size); send_image->Zip(img_buffer, &zip_buffer_size);
img_buffer_size = zip_buffer_size; img_buffer_size = zip_buffer_size;
#else
Error("zlib is required for zipped images. Falling back to raw image");
type = STREAM_RAW;
#endif // HAVE_ZLIB_H
break; break;
default : default :
Error("Unexpected frame type %d", type); Error("Unexpected frame type %d", type);
@ -794,6 +799,8 @@ void MonitorStream::SingleImageRaw( int scale ) {
fwrite( snap_image->Buffer(), snap_image->Size(), 1, stdout ); fwrite( snap_image->Buffer(), snap_image->Size(), 1, stdout );
} }
#ifdef HAVE_ZLIB_H
void MonitorStream::SingleImageZip( int scale ) { void MonitorStream::SingleImageZip( int scale ) {
unsigned long img_buffer_size = 0; unsigned long img_buffer_size = 0;
static Bytef img_buffer[ZM_MAX_IMAGE_SIZE]; static Bytef img_buffer[ZM_MAX_IMAGE_SIZE];
@ -816,3 +823,4 @@ void MonitorStream::SingleImageZip( int scale ) {
fprintf( stdout, "Content-Type: image/x-rgbz\r\n\r\n" ); fprintf( stdout, "Content-Type: image/x-rgbz\r\n\r\n" );
fwrite( img_buffer, img_buffer_size, 1, stdout ); fwrite( img_buffer, img_buffer_size, 1, stdout );
} }
#endif // HAVE_ZLIB_H

View File

@ -55,7 +55,9 @@ class MonitorStream : public StreamBase {
void processCommand( const CmdMsg *msg ); void processCommand( const CmdMsg *msg );
void SingleImage( int scale=100 ); void SingleImage( int scale=100 );
void SingleImageRaw( int scale=100 ); void SingleImageRaw( int scale=100 );
#ifdef HAVE_ZLIB_H
void SingleImageZip( int scale=100 ); void SingleImageZip( int scale=100 );
#endif
public: public:
MonitorStream() : MonitorStream() :