X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswfbits.c;h=df8c1c96fe73821730024a8eede25d2d8050ebdf;hb=58e7d89f8115525c32a0e3f3f4e5501c6a17186d;hp=0454f10c736fae3b3a406d496ca78703b4770155;hpb=0e4e674622c2f2adb7946bca3b773bcaf0750d5d;p=swftools.git diff --git a/lib/modules/swfbits.c b/lib/modules/swfbits.c index 0454f10..df8c1c9 100644 --- a/lib/modules/swfbits.c +++ b/lib/modules/swfbits.c @@ -7,9 +7,19 @@ Copyright (c) 2000, 2001 Rainer Böhme - 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 @@ -128,6 +138,26 @@ void swf_SetJPEGBits2(TAG * tag,U16 width,U16 height,RGBA* bitmap, int quality) 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;