/* We reset the empty-input-file flag for each image, *butwedon'tcleartheinputbuffer. *Thisiscorrectbehaviorforreadingaseriesofimagesfromonesource.
*/
src->start_of_file = TRUE;
}
METHODDEF(void)
init_mem_source(j_decompress_ptr cinfo)
{ /* no work necessary here */
}
/* The whole JPEG data is expected to reside in the supplied memory *buffer,soanyrequestformoredatabeyondthegivenbuffersize *istreatedasanerror.
*/
WARNMS(cinfo, JWRN_JPEG_EOF);
/* Just a dumb implementation for now. Could use fseek() except *itdoesn'tworkonpipes.Notclearthatbeingsmartisworth *anytroubleanyway---largeskipsareinfrequent.
*/ if (num_bytes > 0) { while (num_bytes > (long)src->bytes_in_buffer) {
num_bytes -= (long)src->bytes_in_buffer;
(void)(*src->fill_input_buffer) (cinfo); /* note we assume that fill_input_buffer will never return FALSE, *sosuspensionneednotbehandled.
*/
}
src->next_input_byte += (size_t)num_bytes;
src->bytes_in_buffer -= (size_t)num_bytes;
}
}
/* The source object and input buffer are made permanent so that a series *ofJPEGimagescanbereadfromthesamefilebycallingjpeg_stdio_src *onlybeforethefirstone.(Ifwediscardedthebufferattheendof *oneimage,we'dlikelylosethestartofthenextone.)
*/ if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT, sizeof(my_source_mgr));
src = (my_src_ptr)cinfo->src;
src->buffer = (JOCTET *)
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
INPUT_BUF_SIZE * sizeof(JOCTET));
} elseif (cinfo->src->init_source != init_source) { /* It is unsafe to reuse the existing source manager unless it was created *bythisfunction.Otherwise,thereisnoguaranteethattheopaque *structureistherightsize.Notethatwecouldjustcreateanew *structure,buttheoldstructurewouldnotbefreeduntil *jpeg_destroy_decompress()wascalled.
*/
ERREXIT(cinfo, JERR_BUFFER_SIZE);
}
if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */
ERREXIT(cinfo, JERR_INPUT_EMPTY);
/* The source object is made permanent so that a series of JPEG images *canbereadfromthesamebufferbycallingjpeg_mem_srconlybefore *thefirstone.
*/ if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT, sizeof(struct jpeg_source_mgr));
} elseif (cinfo->src->init_source != init_mem_source) { /* It is unsafe to reuse the existing source manager unless it was created *bythisfunction.
*/
ERREXIT(cinfo, JERR_BUFFER_SIZE);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.