|
From: Axel H. <ax...@3d...> - 2011-04-11 07:53:47
|
Hi,
could need some advice while trying to get the movie as byte array with
SWFMovie_output_to_stream
but the result is smaller than the output from SWFMovie which loads
correct in the flashplayer while the former does not.
Maybe I made a mistake - the code below traces:
streamed size:24 = 24 string:FWS
saved size:28
#define _GNU_SOURCE
#include <ming.h>
#include <stdlib.h>
#include <string.h>
int main()
{
SWFMovie movie;
char *bp;
FILE *stream;
size_t size;
int ssize;
movie = newSWFMovie();
stream = open_memstream(&bp, &size);
if (stream == NULL)
{
printf("oops - couldn't open memstream :-(\n");
return 1;
}
ssize = SWFMovie_output_to_stream(movie, stream);
fclose(stream);
printf("streamed size:%i = %i string:%s\n",ssize, size, bp);
FILE *fo = fopen("string.swf", "w");
int i;
for(i=0;i<size;i++)
fputc(bp[i], fo);
fclose(fo);
free(bp);
ssize = SWFMovie_save(movie, "saved.swf");
printf("saved size:%i \n",ssize);
return 0;
}
|