reworked compression handling logic
authorkramm <kramm>
Wed, 12 Mar 2008 19:06:48 +0000 (19:06 +0000)
committerkramm <kramm>
Wed, 12 Mar 2008 19:06:48 +0000 (19:06 +0000)
avi2swf/v2swf.c
lib/devices/swf.c
lib/example/protect.c
lib/h.263/swfvideo.c
lib/python/SWF.c
src/gif2swf.c
src/jpeg2swf.c
src/png2swf.c
src/swfc.c
src/swfcombine.c

index 7d24c21..182821a 100644 (file)
@@ -1064,7 +1064,7 @@ void v2swf_backpatch(v2swf_t*v2swf, char*filename)
                close(fi);
                fi = open(filename, O_WRONLY|O_BINARY|O_TRUNC|O_CREAT, 0666);
                if(fi>=0) {
-                   swf_WriteSWC(fi, &tmp);
+                   swf_WriteSWF(fi, &tmp);
                    close(fi);
                    msg("v2swf_backpatch %s - fix header: success\n", filename);
                }
index 205163f..05567ae 100644 (file)
@@ -1278,13 +1278,8 @@ int swfresult_save(gfxresult_t*gfx, const char*filename)
        return -1;
     }
     
-    if(swf->compressed) {
-       if FAILED(swf_WriteSWC(fi,swf)) 
-           msg("<error> WriteSWC() failed.\n");
-    } else {
-       if FAILED(swf_WriteSWF(fi,swf)) 
-           msg("<error> WriteSWF() failed.\n");
-    }
+    if FAILED(swf_WriteSWF(fi,swf)) 
+        msg("<error> WriteSWF() failed.\n");
 
     if(filename)
      close(fi);
index e6127d1..2bf2f70 100644 (file)
@@ -74,10 +74,8 @@ int main(int argn,char ** argv)
     if(fi<0) {
        fprintf(stderr, "couldn't create output file %s", outfilename);
     }
-    if(swf.compressed) 
-       {if(swf_WriteSWC(fi, &swf)<0) fprintf(stderr, "WriteSWC() failed.\n");}
-    else
-       {if(swf_WriteSWF(fi, &swf)<0) fprintf(stderr, "WriteSWF() failed.\n");}
+    if(swf_WriteSWF(fi, &swf)<0) 
+        fprintf(stderr, "WriteSWF() failed.\n");
 
     close(fi);
     
index 1b075ff..ae31564 100644 (file)
@@ -1499,7 +1499,7 @@ void mkblack()
     tag = swf_InsertTag(tag, ST_END);
 
     int fi = open("black.swf", O_WRONLY|O_CREAT|O_TRUNC, 0644);
-    if(swf_WriteSWC(fi,&swf)<0) {
+    if(swf_WriteSWF(fi,&swf)<0) {
        fprintf(stderr,"WriteSWF() failed.\n");
     }
     close(fi);
@@ -1634,7 +1634,7 @@ int main(int argn, char*argv[])
     tag = swf_InsertTag(tag, ST_END);
 
     fi = open("video3.swf", O_WRONLY|O_CREAT|O_TRUNC, 0644);
-    if(swf_WriteSWC(fi,&swf)<0) {
+    if(swf_WriteSWF(fi,&swf)<0) {
        fprintf(stderr,"WriteSWF() failed.\n");
     }
     close(fi);
index 55f6192..050b36a 100644 (file)
@@ -211,18 +211,10 @@ static PyObject * swf_save(PyObject* self, PyObject* args, PyObject* kwargs)
        PyErr_SetString(PyExc_Exception, setError("couldn't create output file %s", filename));
        return 0;
     }
-    if(swf->compressed) {
-           if(swf_WriteSWC(fi, swf)<0) {
-               close(fi);
-               PyErr_SetString(PyExc_Exception, setError("WriteSWC() failed."));
-               return 0;
-           }
-    } else {
-           if(swf_WriteSWF(fi, swf)<0) {
-               close(fi);
-               PyErr_SetString(PyExc_Exception, setError("WriteSWC() failed."));
-               return 0;
-           }
+    if(swf_WriteSWF(fi, swf)<0) {
+        close(fi);
+        PyErr_SetString(PyExc_Exception, setError("WriteSWC() failed."));
+        return 0;
     }
     close(fi);
 
index e1379ac..6f60865 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- mode: c; tab-width: 4; -*- ---------------------------[for (x)emacs]--
 
-   $Id: gif2swf.c,v 1.6 2007/01/13 17:26:47 kramm Exp $
+   $Id: gif2swf.c,v 1.7 2008/03/12 19:13:31 kramm Exp $
    GIF to SWF converter tool
 
    Part of the swftools package.
@@ -184,13 +184,8 @@ int MovieFinish(SWF * swf, TAG * t, char *sname)
         if FAILED
             (swf_WriteCGI(swf)) fprintf(stderr, "WriteCGI() failed.\n");
     } else {
-        if (global.version >= 6) {
-            if (swf_WriteSWC(f, swf) < 0)
-                fprintf(stderr, "Unable to write output file: %s\n", sname);
-        } else {
-            if (swf_WriteSWF(f, swf) < 0)
-                fprintf(stderr, "Unable to write output file: %s\n", sname);
-        }
+        if (swf_WriteSWF(f, swf) < 0)
+            fprintf(stderr, "Unable to write output file: %s\n", sname);
         if (f != so)
             close(f);
     }
index 7c1298f..544e7c9 100644 (file)
@@ -136,13 +136,8 @@ int MovieFinish(SWF * swf, TAG * t, char *sname)
            sname = "output.swf";
        handle = open(sname, O_BINARY | O_RDWR | O_CREAT | O_TRUNC, 0666);
     }
-    if(global.version >= 6) {
-       if (swf_WriteSWC(handle, swf)<0) 
-               fprintf(stderr, "Unable to write output file: %s\n", sname);
-    } else {
-       if (swf_WriteSWF(handle, swf)<0) 
-               fprintf(stderr, "Unable to write output file: %s\n", sname);
-    }
+    if (swf_WriteSWF(handle, swf)<0) 
+        fprintf(stderr, "Unable to write output file: %s\n", sname);
 
     if (handle != so)
        close(handle);
index 0878543..ffca258 100644 (file)
@@ -100,13 +100,8 @@ int MovieFinish(SWF * swf, TAG * t, char *sname)
     if(global.do_cgi) {
        if FAILED(swf_WriteCGI(swf)) fprintf(stderr,"WriteCGI() failed.\n");
     } else {
-       if(global.version >= 6) {
-           if (swf_WriteSWC(f, swf)<0) 
-                   fprintf(stderr, "Unable to write output file: %s\n", sname);
-       } else {
-           if (swf_WriteSWF(f, swf)<0) 
-                   fprintf(stderr, "Unable to write output file: %s\n", sname);
-       }
+        if (swf_WriteSWF(f, swf)<0) 
+            fprintf(stderr, "Unable to write output file: %s\n", sname);
        if (f != so)
            close(f);
     }
index 1875129..c07a8a0 100644 (file)
@@ -1039,8 +1039,6 @@ static void s_endSWF()
     }
     if(do_cgi)
        {if(swf_WriteCGI(swf)<0) syntaxerror("WriteCGI() failed.\n");}
-    else if(swf->compressed)
-       {if(swf_WriteSWC(fi, swf)<0) syntaxerror("WriteSWC() failed.\n");}
     else
        {if(swf_WriteSWF(fi, swf)<0) syntaxerror("WriteSWF() failed.\n");}
 
index 9ada1a6..b4dbfb9 100644 (file)
@@ -1283,9 +1283,10 @@ int main(int argn, char *argv[])
     if(config.zlib) {
        if(newswf.fileVersion < 6)
            newswf.fileVersion = 6;
-       swf_WriteSWC(fi, &newswf);
+        newswf.compressed = 1;
+       swf_WriteSWF(fi, &newswf);
     } else {
-       newswf.compressed = 0;
+       newswf.compressed = -1; // don't compress
        swf_WriteSWF(fi, &newswf);
     }
     close(fi);