named tags are now anchors by default.
[swftools.git] / src / swfc.c
index 40f011f..caa2a52 100644 (file)
@@ -727,11 +727,13 @@ void s_frame(int nr, int cut, char*name)
        if(t==nr-1 && name && *name) {
            tag = swf_InsertTag(tag, ST_FRAMELABEL);
            swf_SetString(tag, name);
+           swf_SetU8(tag, 1); //make this an anchor
        }
     }
     if(nr == 0 && currentframe == 0 && name) {
         tag = swf_InsertTag(tag, ST_FRAMELABEL);
         swf_SetString(tag, name);
+       swf_SetU8(tag, 1); //make this an anchor
     }
 
     if(cut) {
@@ -1156,6 +1158,10 @@ void s_font(char*name, char*filename)
     font->id = id;
     tag = swf_InsertTag(tag, ST_DEFINEFONT2);
     swf_FontSetDefine2(tag, font);
+    tag = swf_InsertTag(tag, ST_EXPORTASSETS);
+    swf_SetU16(tag, 1);
+    swf_SetU16(tag, id);
+    swf_SetString(tag, name);
     incrementid();
 
     if(dictionary_lookup(&fonts, name))
@@ -1178,6 +1184,7 @@ void s_sound(char*name, char*filename)
     U16*samples;
     int numsamples;
     int t;
+    int blocksize = 1152;
 
     if(!readWAV(filename, &wav)) {
        warning("Couldn't read wav file \"%s\"", filename);
@@ -1195,6 +1202,20 @@ void s_sound(char*name, char*filename)
        }
 #endif
     }
+    
+    if(numsamples%blocksize != 0)
+    {
+       // apply padding, so that block is a multiple of blocksize
+       int numblocks = (numsamples+blocksize-1)/blocksize;
+       int numsamples2;
+       U16* samples2;
+       numsamples2 = numblocks * blocksize;
+       samples2 = malloc(sizeof(U16)*numsamples2);
+       memcpy(samples2, samples, numsamples*sizeof(U16));
+       memset(&samples2[numsamples], 0, sizeof(U16)*(numsamples2 - numsamples));
+       numsamples = numsamples2;
+       samples = samples2;
+    }
 
     tag = swf_InsertTag(tag, ST_DEFINESOUND);
     swf_SetU16(tag, id); //id