7 struct jpeg_source_mgr pub
; /* public fields */
9 JOCTET
* buffer
; /* start of buffer */
10 int bytes
; /* total size of buffer */
13 typedef my_source_mgr
* my_src_ptr
;
16 quicktime_jpeg_init_source (j_decompress_ptr cinfo
)
18 my_src_ptr src
= (my_src_ptr
) cinfo
->src
;
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;
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
;
46 quicktime_jpeg_term_source (j_decompress_ptr cinfo
)
51 jpeg_buffer_src (j_decompress_ptr cinfo
, unsigned char *buffer
, long bytes
)
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
;