컴퓨터 개발/C/C++ and....
Ming을 이용한 mp3 to swf
yhlee
2012. 8. 8. 10:38
#include < ming.h> #include < stdlib.h> //#include < sys/stat.h> int main(int argc, char* argv[]) { SWFMovie m; SWFSoundStream stream; FILE* file; //struct stat st; int size; if(argc != 2){ fprintf(stderr, "올바르지 않는 사용방법"); return EXIT_FAILURE; } char *filename = argv[1]; if((file = fopen(filename, "rb")) != NULL){ /* 파일 사이즈 구하기 */ //stat("test.mp3", &st); //long size = st.st_size; /* Flash 버전 정보 */ m = newSWFMovieWithVersion(7); /* Stream 추가 */ stream = newSWFSoundStream(file); if(stream == NULL){ fprintf(stderr, "SoundStream failed\n"); return EXIT_FAILURE; } size = SWFSoundStream_getFrames(stream); /* mp3의 파일 사이즈 만큼 Frame을 늘려 준다.*/ SWFMovie_setNumberOfFrames(m, size ); /* mp3 파일을 기본 사운드로 등록 */ SWFMovie_setSoundStream(m, stream); /* flash 파일 저장 */ SWFMovie_save(m, "mp3toswf.swf"); fclose(file); } else { perror("test.mp3"); return EXIT_FAILURE; } return EXIT_SUCCESS; }