OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Functions
ossimJpegStdIOSrc.h File Reference
#include <ossim/base/ossimConstants.h>
#include <cstdio>

Go to the source code of this file.

Functions

OSSIM_DLL void ossimJpegStdIOSrc (jpeg_decompress_struct *cinfo, FILE *infile)
 Method which uses memory instead of a FILE* to read from. More...
 

Function Documentation

◆ ossimJpegStdIOSrc()

OSSIM_DLL void ossimJpegStdIOSrc ( jpeg_decompress_struct *  cinfo,
FILE *  infile 
)

Method which uses memory instead of a FILE* to read from.

Note
Used in place of "jpeg_stdio_src(&cinfo, infile)".

Definition at line 219 of file ossimJpegStdIOSrc.cpp.

References ossimJpegStdIOSourceMgr::buffer, ossimJpegStdIOSourceMgr::infile, INPUT_BUF_SIZE, ossimJpegStdIOSrc_fill_input_buffer(), ossimJpegStdIOSrc_init_source(), ossimJpegStdIOSrc_skip_input_data(), ossimJpegStdIOSrc_term_source(), ossimJpegStdIOSourceMgr::pub, and SIZEOF.

Referenced by ossimJpegTileSource::restart().

220  {
222 
223  /* The source object and input buffer are made permanent so that a series
224  * of JPEG images can be read from the same file by calling jpeg_stdio_src
225  * only before the first one. (If we discarded the buffer at the end of
226  * one image, we'd likely lose the start of the next one.)
227  * This makes it unsafe to use this manager and a different source
228  * manager serially with the same JPEG object. Caveat programmer.
229  */
230  if (cinfo->src == NULL) { /* first time for this JPEG object? */
231  cinfo->src = (struct jpeg_source_mgr *)
232  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
234  src = (ossimJpegStdIOSourceMgrPtr) cinfo->src;
235  src->buffer = (JOCTET *)
236  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
237  INPUT_BUF_SIZE * SIZEOF(JOCTET));
238  }
239 
240  src = (ossimJpegStdIOSourceMgrPtr) cinfo->src;
241  src->pub.init_source = ossimJpegStdIOSrc_init_source;
242  src->pub.fill_input_buffer = ossimJpegStdIOSrc_fill_input_buffer;
243  src->pub.skip_input_data = ossimJpegStdIOSrc_skip_input_data;
244  src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
245  src->pub.term_source = ossimJpegStdIOSrc_term_source;
246  src->infile = infile;
247  src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
248  src->pub.next_input_byte = NULL; /* until buffer loaded */
249  }
#define SIZEOF(object)
#define INPUT_BUF_SIZE
for jmp_buf
void ossimJpegStdIOSrc_term_source(j_decompress_ptr cinfo)
ossimJpegStdIOSourceMgr * ossimJpegStdIOSourceMgrPtr
struct jpeg_source_mgr pub
void ossimJpegStdIOSrc_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
void ossimJpegStdIOSrc_init_source(j_decompress_ptr cinfo)
boolean ossimJpegStdIOSrc_fill_input_buffer(j_decompress_ptr cinfo)