01_make_mjpeg_printfs_optional.patch (1877B)
1 # HG changeset patch 2 # User Randell Jesup <rjesup@jesup.org> 3 # Parent 5d4d728adccff4539e44f697b8011fb2eb1a1ad5 4 5 diff --git a/source/mjpeg_decoder.cc b/source/mjpeg_decoder.cc 6 --- a/source/mjpeg_decoder.cc 7 +++ b/source/mjpeg_decoder.cc 8 @@ -73,18 +73,20 @@ MJpegDecoder::MJpegDecoder() 9 databuf_strides_(NULL) { 10 decompress_struct_ = new jpeg_decompress_struct; 11 source_mgr_ = new jpeg_source_mgr; 12 #ifdef HAVE_SETJMP 13 error_mgr_ = new SetJmpErrorMgr; 14 decompress_struct_->err = jpeg_std_error(&error_mgr_->base); 15 // Override standard exit()-based error handler. 16 error_mgr_->base.error_exit = &ErrorHandler; 17 +#ifndef DEBUG_MJPEG 18 error_mgr_->base.output_message = &OutputHandler; 19 #endif 20 +#endif 21 decompress_struct_->client_data = NULL; 22 source_mgr_->init_source = &init_source; 23 source_mgr_->fill_input_buffer = &fill_input_buffer; 24 source_mgr_->skip_input_data = &skip_input_data; 25 source_mgr_->resync_to_restart = &jpeg_resync_to_restart; 26 source_mgr_->term_source = &term_source; 27 jpeg_create_decompress(decompress_struct_); 28 decompress_struct_->src = source_mgr_; 29 @@ -450,21 +452,22 @@ void ErrorHandler(j_common_ptr cinfo) { 30 #endif 31 32 SetJmpErrorMgr* mgr = reinterpret_cast<SetJmpErrorMgr*>(cinfo->err); 33 // This rewinds the call stack to the point of the corresponding setjmp() 34 // and causes it to return (for a second time) with value 1. 35 longjmp(mgr->setjmp_buffer, 1); 36 } 37 38 +#ifndef DEBUG_MJPEG 39 // Suppress fprintf warnings. 40 void OutputHandler(j_common_ptr cinfo) { 41 (void)cinfo; 42 } 43 - 44 +#endif 45 #endif // HAVE_SETJMP 46 47 void MJpegDecoder::AllocOutputBuffers(int num_outbufs) { 48 if (num_outbufs != num_outbufs_) { 49 // We could perhaps optimize this case to resize the output buffers without 50 // necessarily having to delete and recreate each one, but it's not worth 51 // it. 52 DestroyOutputBuffers();