Copyright (c) 2000, 2001 Rainer Böhme <rfxswf@reflex-studio.de>
- This file is distributed under the GPL, see file COPYING for details
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-*/
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define OUTBUFFER_SIZE 0x8000
swf_SetJPEGBitsFinish(jpeg);
}
+void swf_GetJPEGSize(char * fname, int*width, int*height)
+{ struct jpeg_decompress_struct cinfo;
+ struct jpeg_error_mgr jerr;
+ FILE * fi;
+ *width = 0;
+ *height = 0;
+ cinfo.err = jpeg_std_error(&jerr);
+ jpeg_create_decompress(&cinfo);
+ if ((fi=fopen(fname,"rb"))==NULL) {
+ fprintf(stderr, "rfxswf: file open error\n");
+ return;
+ }
+ jpeg_stdio_src(&cinfo, fi);
+ jpeg_read_header(&cinfo, TRUE);
+ *width = cinfo.image_width;
+ *height = cinfo.image_height;
+ jpeg_destroy_decompress(&cinfo);
+ fclose(fi);
+}
+
int swf_SetJPEGBits(TAG * t,char * fname,int quality)
{ struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
} else res = -3; // zlib error
}
-
- while(t->len < 64) { /* actually, 63 and above is o.k., but let's stay on the safe side */
-
- /* Flash players up to MX crash or do strange things if they encounter a
- DefineLossless Tag with a payload of less than 63 bytes. They also
- substitute the whole bitmap by a red rectangle.
-
- This loop fills up the tag with zeroes so that this doesn't happen.
- */
- swf_SetU8(t, 0);
- }
-
return res;
}
if (!palette) free(pal);
- while(t->len < 64) { /* actually, 63 and above is o.k., but let's stay on the safe side */
-
- /* Flash players up to MX crash or do strange things if they encounter a
- DefineLossless(2) Tag with a payload of less than 63 bytes. They also
- substitute the whole bitmap by a red rectangle.
-
- This loop fills up the tag with zeroes so that this doesn't happen.
- */
- swf_SetU8(t, 0);
- }
-
return res;
}