r730: Added italian translation
[cinelerra_cv/mob.git] / quicktime / jdatasrc.c
blob11b2c5f7dad21e041da9e38a4119e69e1ef2630a
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "jpeglib.h"
4 #include "jerror.h"
6 typedef struct {
7 struct jpeg_source_mgr pub; /* public fields */
9 JOCTET * buffer; /* start of buffer */
10 int bytes; /* total size of buffer */
11 } my_source_mgr;
13 typedef my_source_mgr * my_src_ptr;
15 METHODDEF(void)
16 quicktime_jpeg_init_source (j_decompress_ptr cinfo)
18 my_src_ptr src = (my_src_ptr) cinfo->src;
21 METHODDEF(boolean)
22 quicktime_jpeg_fill_input_buffer (j_decompress_ptr cinfo)
24 my_src_ptr src = (my_src_ptr) cinfo->src;
26 src->buffer[0] = (JOCTET) 0xFF;
27 src->buffer[1] = (JOCTET) JPEG_EOI;
28 src->pub.next_input_byte = src->buffer;
29 src->pub.bytes_in_buffer = 2;
31 return TRUE;
35 METHODDEF(void)
36 quicktime_jpeg_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
38 my_src_ptr src = (my_src_ptr) cinfo->src;
40 src->pub.next_input_byte += (size_t) num_bytes;
41 src->pub.bytes_in_buffer -= (size_t) num_bytes;
45 METHODDEF(void)
46 quicktime_jpeg_term_source (j_decompress_ptr cinfo)
50 GLOBAL(void)
51 jpeg_buffer_src (j_decompress_ptr cinfo, unsigned char *buffer, long bytes)
53 my_src_ptr src;
55 if (cinfo->src == NULL) { /* first time for this JPEG object? */
56 cinfo->src = (struct jpeg_source_mgr *)
57 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
58 sizeof(my_source_mgr));
59 src = (my_src_ptr) cinfo->src;
62 src = (my_src_ptr) cinfo->src;
63 src->pub.init_source = quicktime_jpeg_init_source;
64 src->pub.fill_input_buffer = quicktime_jpeg_fill_input_buffer;
65 src->pub.skip_input_data = quicktime_jpeg_skip_input_data;
66 src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
67 src->pub.term_source = quicktime_jpeg_term_source;
68 src->pub.bytes_in_buffer = bytes;
69 src->pub.next_input_byte = buffer;
70 src->buffer = buffer;
71 src->bytes = bytes;