Go to the source code of this file.
Classes | |
| struct | my_destination_mgr |
Defines | |
| #define | OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ |
Typedefs | |
| typedef boolean(* | boolean_jpeg_compress_struct )(jpeg_compress_struct *) |
| typedef void(* | void_jpeg_compress_struct )(jpeg_compress_struct *) |
| typedef my_destination_mgr * | my_dest_ptr |
Functions | |
| init_destination (j_compress_ptr cinfo) | |
| empty_output_buffer (j_compress_ptr cinfo) | |
| term_destination (j_compress_ptr cinfo) | |
| jpeg_stdio_dest (j_compress_ptr cinfo, std::ofstream *outfile) | |
|
|
Definition at line 36 of file jdatadst.cxx. Referenced by empty_output_buffer(), init_destination(), and term_destination(). |
|
|
Definition at line 23 of file jdatadst.cxx. |
|
|
Definition at line 34 of file jdatadst.cxx. Referenced by empty_output_buffer(), init_destination(), jpeg_stdio_dest(), and term_destination(). |
|
|
Definition at line 24 of file jdatadst.cxx. |
|
|
Definition at line 84 of file jdatadst.cxx. References my_destination_mgr::buffer, my_dest_ptr, my_destination_mgr::outfile, OUTPUT_BUF_SIZE, and my_destination_mgr::pub. Referenced by jpeg_stdio_dest().
00084 {
00085 my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
00086
00087 #if 0
00088 if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) !=
00089 (size_t) OUTPUT_BUF_SIZE)
00090 ERREXIT(cinfo, JERR_FILE_WRITE);
00091 #else
00092 dest->outfile->write((char*)dest->buffer, OUTPUT_BUF_SIZE);
00093 if( dest->outfile->fail() )
00094 ERREXIT(cinfo, JERR_FILE_WRITE);
00095 #endif
00096
00097 dest->pub.next_output_byte = dest->buffer;
00098 dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
00099
00100 return TRUE;
00101 }
00102
|
|
|
Definition at line 46 of file jdatadst.cxx. References my_destination_mgr::buffer, my_dest_ptr, OUTPUT_BUF_SIZE, and my_destination_mgr::pub. Referenced by jpeg_stdio_dest().
00046 {
00047 my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
00048
00049 /* Allocate the output buffer --- it will be released when done with image */
00050 dest->buffer = (JOCTET *)
00051 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
00052 OUTPUT_BUF_SIZE * SIZEOF(JOCTET));
00053
00054 dest->pub.next_output_byte = dest->buffer;
00055 dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
00056 }
00057
|
|
||||||||||||
|
Definition at line 151 of file jdatadst.cxx. References empty_output_buffer(), init_destination(), my_dest_ptr, my_destination_mgr::outfile, my_destination_mgr::pub, and term_destination().
00151 {
00152 my_dest_ptr dest;
00153
00154 /* The destination object is made permanent so that multiple JPEG images
00155 * can be written to the same file without re-executing jpeg_stdio_dest.
00156 * This makes it dangerous to use this manager and a different destination
00157 * manager serially with the same JPEG object, because their private object
00158 * sizes may be different. Caveat programmer.
00159 */
00160 if (cinfo->dest == NULL) { /* first time for this JPEG object? */
00161 cinfo->dest = (struct jpeg_destination_mgr *)
00162 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
00163 SIZEOF(my_destination_mgr));
00164 }
00165
00166 dest = (my_dest_ptr) cinfo->dest;
00167 dest->pub.init_destination = reinterpret_cast<void_jpeg_compress_struct>(init_destination);
00168 dest->pub.empty_output_buffer = reinterpret_cast<boolean_jpeg_compress_struct>(empty_output_buffer);
00169 dest->pub.term_destination = reinterpret_cast<void_jpeg_compress_struct>(term_destination);
00170 dest->outfile = outfile;
00171 }
00172 }
|
|
|
Definition at line 115 of file jdatadst.cxx. References my_destination_mgr::buffer, my_dest_ptr, my_destination_mgr::outfile, OUTPUT_BUF_SIZE, and my_destination_mgr::pub. Referenced by jpeg_stdio_dest().
00115 {
00116 my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
00117 size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;
00118
00119 /* Write any data remaining in the buffer */
00120 #if 0
00121 if (datacount > 0) {
00122 if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
00123 ERREXIT(cinfo, JERR_FILE_WRITE);
00124 }
00125 fflush(dest->outfile);
00126 /* Make sure we wrote the output file OK */
00127 if (ferror(dest->outfile))
00128 ERREXIT(cinfo, JERR_FILE_WRITE);
00129 #else
00130 if (datacount > 0) {
00131 dest->outfile->write((char*)dest->buffer, datacount);
00132 if (dest->outfile->fail())
00133 ERREXIT(cinfo, JERR_FILE_WRITE);
00134 dest->outfile->flush();
00135 /* Make sure we wrote the output file OK */
00136 if (dest->outfile->fail())
00137 ERREXIT(cinfo, JERR_FILE_WRITE);
00138 }
00139 #endif
00140 }
00141
|
1.3.6