X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fswfdump.c;h=df55e9be31fcc26174ace1713fd6b99dee2e57ee;hb=89174f31c34e6a727efe9600b4a81c90dc63e23a;hp=c6ab0d292b9eba9bf2b7ae3e753b3eb8a9264825;hpb=639537b59f2caa6f5bb016f3b15ceb3c2be3fe3b;p=swftools.git diff --git a/src/swfdump.c b/src/swfdump.c index c6ab0d2..df55e9b 100644 --- a/src/swfdump.c +++ b/src/swfdump.c @@ -7,6 +7,10 @@ This file is distributed under the GPL, see file COPYING for details */ +#ifdef HAVE_SYS_STAT_H +#include +#endif +#include #include #include #include "../lib/rfxswf.h" @@ -31,6 +35,7 @@ int args_callback_option(char*name,char*val) { if(!strcmp(name, "V")) { printf("swfdump - part of %s %s\n", PACKAGE, VERSION); + exit(0); } } int args_callback_longoption(char*name,char*val) @@ -55,6 +60,9 @@ int main (int argc,char ** argv) { SWF swf; TAG*tag; +#ifdef HAVE_SYS_STAT_H + struct stat statbuf; +#endif int f; char prefix[128]; prefix[0] = 0; @@ -75,12 +83,27 @@ int main (int argc,char ** argv) close(f); exit(1); } + +#ifdef HAVE_SYS_STAT_H + fstat(f, &statbuf); + if(statbuf.st_size != swf.FileSize) + fprintf(stderr, "Error: Real Filesize (%d) doesn't match header Filesize (%d)", + statbuf.st_size, swf.FileSize); +#endif + close(f); + printf("[HEADER] File version: %d\n", swf.FileVersion); + printf("[HEADER] File size: %d\n", swf.FileSize); + printf("[HEADER] Frame rate: %f\n",swf.FrameRate/256.0); + printf("[HEADER] Frame count: %d\n",swf.FrameCount); + printf("[HEADER] Movie width: %.3f\n",(swf.MovieSize.xmax-swf.MovieSize.xmin)/20.0); + printf("[HEADER] Movie height: %.3f\n",(swf.MovieSize.ymax-swf.MovieSize.ymin)/20.0); + tag = swf.FirstTag; while(tag) { - printf("[%02x] %s%s", tag->id, prefix, getTagName(tag)); + printf("[%03x] %9d %s%s", tag->id, tag->len, prefix, getTagName(tag)); if(isDefiningTag(tag)) { U16 id = GetDefineID(tag); printf(" defines id %04x", id);