
#include <unistd.h>
#include <ming.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

int main(int argc, char *argv[]) {
	SWFMovie m;
	SWFVideoStream stream;
	SWFDisplayItem item;
	SWFAction a;
	

	/*
	 * this script starts a "download"-stream
	 * NOTE: works only with FlashPlayer >= 7
	 */
	const char *script = "stop(); nc=new NetConnection(); nc.connect(null); NewStream=new NetStream(nc); video1.attachVideo(NewStream); 	NewStream.setBufferTime(10); NewStream.play(\"test.flv\");";

	/*
	 * this script starts the rtmp-stream from the Macromedia Communication Server 
	 * works with FlashPlayer >= 6
	 */
//	const char *script = "stop(); nc=new NetConnection(); nc.connect(\"rtmp://localhost/test/video\"); NewStream=new NetStream(nc); video1.attachVideo(NewStream); 	NewStream.setBufferTime(10); NewStream.play(\"test\");";
	
	a = compileSWFActionCode(script);
	
	m = newSWFMovie();
	SWFMovie_setDimension(m, 800, 600);
	SWFMovie_setRate(m, 8);
	
	stream = newSWFVideoStream();
	item = SWFMovie_add(m, stream);
	SWFDisplayItem_setName(item, "video1");
	SWFMovie_add(m, a);
	SWFMovie_nextFrame(m);
	SWFMovie_save(m, "test.swf", 9);
	exit(0);
}
	
	

	
