git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ffced7b
)
fixes for zlib compression, new function swf_ResetTag.
author
kramm
<kramm>
Fri, 14 Feb 2003 19:49:26 +0000
(19:49 +0000)
committer
kramm
<kramm>
Fri, 14 Feb 2003 19:49:26 +0000
(19:49 +0000)
lib/rfxswf.c
patch
|
blob
|
history
lib/rfxswf.h
patch
|
blob
|
history
diff --git
a/lib/rfxswf.c
b/lib/rfxswf.c
index
0e00006
..
0563e81
100644
(file)
--- a/
lib/rfxswf.c
+++ b/
lib/rfxswf.c
@@
-651,6
+651,12
@@
void swf_ClearTag(TAG * t)
t->memsize = 0;
}
t->memsize = 0;
}
+void swf_ResetTag(TAG*tag, U16 id)
+{
+ tag->len = tag->pos = tag->readBit = tag->writeBit = 0;
+ tag->id = id;
+}
+
int swf_DeleteTag(TAG * t)
{ if (!t) return -1;
int swf_DeleteTag(TAG * t)
{ if (!t) return -1;
@@
-1119,25
+1125,29
@@
int swf_WriteSWF2(struct writer_t*writer, SWF * swf) // Writes SWF to file,
swf->fileSize = fileSize;
swf->frameCount = frameCount;
}
swf->fileSize = fileSize;
swf->frameCount = frameCount;
}
-
- if(swf->compressed) {
- char*id = "CWS";
- writer->write(writer, id, 3);
- }
- else {
- char*id = "FWS";
- writer->write(writer, id, 3);
- }
- writer->write(writer, &swf->fileVersion, 1);
- PUT32(b4, swf->fileSize);
- writer->write(writer, b4, 4);
+ if(swf->compressed != 8) {
+ /* compressed flag set to 8 means "skip first 8
+ header bytes". This is necessary if the caller wants to
+ create compressed SWFs himself */
+ if(swf->compressed) {
+ char*id = "CWS";
+ writer->write(writer, id, 3);
+ }
+ else {
+ char*id = "FWS";
+ writer->write(writer, id, 3);
+ }
- if(swf->compressed) {
- writer_init_zlibdeflate(&zwriter, writer);
- writer = &zwriter;
+ writer->write(writer, &swf->fileVersion, 1);
+ PUT32(b4, swf->fileSize);
+ writer->write(writer, b4, 4);
+
+ if(swf->compressed) {
+ writer_init_zlibdeflate(&zwriter, writer);
+ writer = &zwriter;
+ }
}
}
-
swf_SetRect(&t1,&swf->movieSize);
swf_SetU16(&t1,swf->frameRate);
swf_SetU16(&t1,swf->frameCount);
swf_SetRect(&t1,&swf->movieSize);
swf_SetU16(&t1,swf->frameRate);
swf_SetU16(&t1,swf->frameCount);
@@
-1160,7
+1170,8
@@
int swf_WriteSWF2(struct writer_t*writer, SWF * swf) // Writes SWF to file,
{ if (swf_WriteTag2(writer, t)<0) return -1;
t = swf_NextTag(t);
}
{ if (swf_WriteTag2(writer, t)<0) return -1;
t = swf_NextTag(t);
}
- writer->finish(writer); //e.g. flush zlib buffers
+ if(swf->compressed != 8)
+ writer->finish(writer); // flush zlib buffers - only if _we_ initialized that writer.
}
}
return (int)fileSize;
}
}
return (int)fileSize;
diff --git
a/lib/rfxswf.h
b/lib/rfxswf.h
index
6da4a50
..
8a87c0f
100644
(file)
--- a/
lib/rfxswf.h
+++ b/
lib/rfxswf.h
@@
-191,7
+191,8
@@
TAG * swf_InsertTag(TAG * after,U16 id); // updates frames, if necessary
int swf_DeleteTag(TAG * t);
void swf_ClearTag(TAG * t); //frees tag data
int swf_DeleteTag(TAG * t);
void swf_ClearTag(TAG * t); //frees tag data
-
+void swf_ResetTag(TAG*tag, U16 id); //set's tag position and length to 0, without freeing it
+
void swf_SetTagPos(TAG * t,U32 pos); // resets Bitcount
U32 swf_GetTagPos(TAG * t);
void swf_SetTagPos(TAG * t,U32 pos); // resets Bitcount
U32 swf_GetTagPos(TAG * t);