2 * Copyright (C) 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * Test for streaming sound
27 #include <sys/types.h>
33 #include "ming_utils.h"
35 #define OUTPUT_VERSION 6
36 #define OUTPUT_FILENAME "streamingSoundTest1.swf"
40 main(int argc
, char** argv
)
46 const char* sound_filename
;
51 sound_filename
=argv
[1];
53 sound_filename
="sound1.mp3";
56 sound_f
= fopen(sound_filename
, "r");
58 perror(sound_filename
);
62 printf("Using sound file %s\n", sound_filename
);
64 if ( -1 == fstat(fileno(sound_f
), &statbuf
) )
69 if ( S_ISDIR(statbuf
.st_mode
) )
71 fprintf(stderr
, "%s is a directory, we need a file\n", sound_filename
);
76 Ming_useSWFVersion (OUTPUT_VERSION
);
79 SWFMovie_setDimension(mo
, 100, 100);
80 SWFMovie_setRate(mo
, 1);
82 ss
= newSWFSoundStream(sound_f
);
84 mc
= newSWFMovieClip();
85 SWFMovieClip_setSoundStream(mc
, ss
, 1);
86 SWFMovieClip_nextFrame(mc
);
88 it
= SWFMovie_add(mo
, mc
);
89 SWFMovie_nextFrame(mo
);
90 SWFMovie_nextFrame(mo
);
91 SWFMovie_nextFrame(mo
);
92 SWFMovie_nextFrame(mo
);
93 SWFMovie_nextFrame(mo
);
94 SWFMovie_nextFrame(mo
);
95 SWFMovie_nextFrame(mo
);
96 SWFMovie_nextFrame(mo
);
99 puts("Saving " OUTPUT_FILENAME
);
100 SWFMovie_save(mo
, OUTPUT_FILENAME
);