new function swf_RemoveJPEGTables()
authorkramm <kramm>
Fri, 21 Jan 2005 17:47:03 +0000 (17:47 +0000)
committerkramm <kramm>
Fri, 21 Jan 2005 17:47:03 +0000 (17:47 +0000)
lib/modules/swfbits.c
lib/rfxswf.h

index f761ae0..19dde1c 100644 (file)
@@ -760,3 +760,36 @@ RGBA* swf_ExtractImage(TAG*tag, int*dwidth, int*dheight)
 
 #undef OUTBUFFER_SIZE
 
 
 #undef OUTBUFFER_SIZE
 
+
+void swf_RemoveJPEGTables(SWF*swf)
+{
+    TAG* tag = swf->firstTag; 
+    TAG* tables_tag = 0;
+    while(tag) {
+       if(tag->id == ST_JPEGTABLES) {
+           tables_tag = tag;
+       }
+       tag = tag->next;
+    }
+    
+    if(!tables_tag)
+       return;
+   
+    tag = swf->firstTag;
+    while(tag) {
+       if(tag->id == ST_DEFINEBITSJPEG) {
+           void*data = rfx_alloc(tag->len);
+           swf_GetBlock(tag, data, tag->len);
+           swf_ResetTag(tag, ST_DEFINEBITSJPEG2);
+           swf_SetBlock(tag, tables_tag->data, tables_tag->len);
+           swf_SetBlock(tag, data, tag->len);
+           free(data);
+       }
+       tag = tag->next;
+    }
+    if(swf->firstTag == tables_tag)
+       swf->firstTag = tables_tag->next;
+    swf_DeleteTag(tables_tag);
+}
+
+
index 9225807..77fc4e9 100644 (file)
@@ -714,6 +714,7 @@ int swf_SetJPEGBits(TAG * t,char * fname,int quality);
 void swf_SetJPEGBits2(TAG * t,U16 width,U16 height,RGBA * bitmap,int quality);
 int swf_SetJPEGBits3(TAG * tag,U16 width,U16 height,RGBA* bitmap, int quality);
 RGBA* swf_JPEG2TagToImage(TAG*tag, int*width, int*height);
 void swf_SetJPEGBits2(TAG * t,U16 width,U16 height,RGBA * bitmap,int quality);
 int swf_SetJPEGBits3(TAG * tag,U16 width,U16 height,RGBA* bitmap, int quality);
 RGBA* swf_JPEG2TagToImage(TAG*tag, int*width, int*height);
+void swf_RemoveJPEGTables(SWF*swf);
 
 #define BYTES_PER_SCANLINE(width) ((width+3)&0xfffffffc)
 
 
 #define BYTES_PER_SCANLINE(width) ((width+3)&0xfffffffc)