void RecordMovie(HWND hWnd){ char szChoice[MAX_PATH]={0}; soundDriver->pause(); OPENFILENAME ofn; // browse button ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hWnd; ofn.lpstrFilter = "Movie File (*.mc2)\0*.mc2\0All files(*.*)\0*.*\0\0"; ofn.lpstrFile = (LPSTR)szChoice; ofn.lpstrTitle = "Record a new movie"; ofn.lpstrDefExt = "mc2"; ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; if(GetSaveFileName(&ofn)) SaveMovie(szChoice, a, 1); //If user did not specify an extension, add .dsm for them // fname = szChoice; // x = fname.find_last_of("."); // if (x < 0) // fname.append(".mc2"); // SetDlgItemText(hwndDlg, IDC_EDIT_FILENAME, fname.c_str()); //if(GetSaveFileName(&ofn)) // UpdateRecordDialogPath(hwndDlg,szChoice); pcejin.tempUnPause(); }
void Movie::Shutdown() { if (IsRecordingInput()) { SaveMovie(); } play_mode = PlayMode::None; recorded_input.resize(0); record_movie_file.clear(); current_byte = 0; init_time = 0; }
int main(int argc, char *argv[]) { int x = 0; int bw = 0, vf = 0, hm = 0, e = 0, p = 0, m = 0; int c = 0, rv = 0, rs = 0, ff = 0; char *fin = NULL, *fout = NULL; int W = 0, H = 0, numFrames = 0; int sFrame = 0, eFrame = 0, res = 0, fFrame = 0; MOVIE *movie; /*entering while loop to check options entered*/ while(x < argc) { /*specify input video*/ if(0 == strcmp(&argv[x][0], "-i")) { if(x < argc - 1) { fin = (char *)malloc(sizeof(char) * (strlen(&argv[x + 1][0]) + strlen(".yuv") + 1)); strcpy(fin, argv[x + 1]); strcat( fin, ".yuv"); }/*fi*/ else { printf("Missing argument for input name!"); free(fin); free(fout); return 5; }/*esle*/ x += 2; continue; }/*fi*/ /*specify output video*/ if(0 == strcmp(&argv[x][0], "-o")) { if(x < argc - 1) { fout = (char *)malloc(sizeof(char) * (strlen(&argv[x + 1][0]) + strlen(".yuv") + 1)); strcpy(fout, argv[x + 1]); strcat( fout, ".yuv"); }/*fi*/ else { printf("Missing argument for output name!"); free(fin); free(fout); return 5; }/*esle*/ x += 2; continue; }/*fi*/ /*set resolution of input stream */ if(0 == strcmp(&argv[x][0], "-s")) { if (x < argc - 1) { if(sscanf(argv[x + 1], "%dx%d", &W, &H) == 2) { assert(W); assert(H); } else { printf("not.\nResolution information provided by -s parameter is incorrect.\n"); PrintUsage(); free(fin); free(fout); return 5; } } else { printf("t.\nResolution information provided by -s parameter is incorrect.\n"); PrintUsage(); free(fin); free(fout); return 5; } x += 2; continue; } /*fi */ if(0 == strcmp(&argv[x][0], "-f")) { if (x < argc - 1) { if(sscanf(argv[x + 1], "%d", &numFrames) == 1) { assert(numFrames); } else { printf("Number of frames information provided by -f parameter is incorrect.\n"); PrintUsage(); free(fin); free(fout); return 5; } } else { printf("Number of frames information provided by -f parameter is incorrect.\n"); PrintUsage(); free(fin); free(fout); return 5; } x += 2; continue; } /* fi */ if ( 0 == strcmp(&argv[x][0], "-m")) { m = 1; x++; continue; } if( 0 == strcmp(&argv[x][0], "-bw")) { bw = 1; x++; continue; } /* fi */ if( 0 == strcmp(&argv[x][0], "-vflip")) { vf = 1; x++; continue; } /* fi */ if( 0 == strcmp(&argv[x][0], "-hmirror")) { hm = 1; x++; continue; } /* fi */ if( 0 == strcmp(&argv[x][0], "-edge")) { e = 1; x++; continue; } /* fi */ if( 0 == strcmp(&argv[x][0], "-poster")) { p = 1; x++; continue; } /* fi */ if ( 0 == strcmp(&argv[x][0], "-rvs")) { rv = 1; x++; continue; } if( 0 == strcmp(&argv[x][0], "-cut")) { if (x < argc -1) { if(sscanf(argv[x + 1], "%d-%d", &sFrame, &eFrame) == 2) { assert(sFrame); assert(eFrame); } else { printf("Frames information given by -cut parameter is incorrect.\n"); PrintUsage(); free(fin); free(fout); return 5; } } else { printf("Frames information given by -cut parameter is incorrect. \n"); PrintUsage(); free(fin); free(fout); return 5; } c = 1; x += 2; continue; } /* fi */ if( 0 == strcmp(&argv[x][0], "-resize")) { if (x < argc - 1) { if (sscanf(argv[x + 1], "%d", &res) == 1) { assert(res); } else { printf("Resolution information given by -resize parameter is incorrect.\n"); PrintUsage(); free(fin); free(fout); return 5; } } else { printf("Resolution information given by -resize parameter is incorrect.\n"); PrintUsage(); free(fin); free(fout); return 5; } rs = 1; x += 2; continue; } /* fi */ if ( 0 == strcmp(&argv[x][0], "-fast")) { if (x < argc - 1) { if (sscanf(argv[x + 1], "%d", &fFrame) == 1) { assert(fFrame); } else { printf("Frames information given by -fast parameter is incorrect.\n"); PrintUsage(); free(fin); free(fout); return 5; } } else { printf("Frames information given by -fast parameter is incorrect.\n"); PrintUsage(); free(fin); free(fout); return 5; } ff = 1; x += 2; continue; } /* fi */ /*help option*/ if(0 == strcmp(&argv[x][0], "-h")) { PrintUsage(); free(fin); free(fout); return 0; }/*fi*/ x++; }/*elihw*/ if(!fin && !m){ printf("Missing argument for input name!\n"); PrintUsage(); free(fin); free(fout); return 5; } if(!fout){ printf("Missing argument for output name!\n"); PrintUsage(); free(fin); free(fout); return 5; } if(W == 0 || H == 0) { printf("Test.\nNo resolution information provided by -s parameter.\n"); PrintUsage(); free(fin); free(fout); return 5; } if(numFrames == 0) { printf("Test.\nNumber of frames information provided by -f parameter is incorrect.\n"); PrintUsage(); free(fin); free(fout); return 5; } movie = CreateMovie(numFrames, W, H); if (m == 1) { MandelbrotMovie(numFrames, W, H, movie); printf("Operation Mandelbrot is done!\n"); } else{ ReadMovie(fin, numFrames, W, H, movie); if(bw == 1) { Movie_DIP_Operation(movie, BlackNWhite); printf("Operation BlackNWhite is done!\n"); } if(vf == 1) { Movie_DIP_Operation(movie, VFlip); printf("Operation VFlip is done!\n"); } if(hm == 1) { Movie_DIP_Operation(movie, HMirror); printf("Operation HMirror is done!\n"); } if(e == 1) { Movie_DIP_Operation(movie, Edge); printf("Operation Edge is done!\n"); } if(p == 1) { Movie_DIP_Operation(movie, Posterize); printf("Operation Posterize is done!\n"); } if(rv == 1) { ReverseImageList(movie->Frames); printf("Operation VFlip is done!\n"); } if(rs == 1) { ResizeImageList(movie->Frames,res); printf("Operation Resize is done! New Width/Height = %dx%d\n", (W*res/100), (H*res/100)); movie->Width = (W*res/100); movie->Height = (H*res/100); } if(c == 1) { CropImageList(movie->Frames, sFrame, eFrame); printf("Operation Frame Cropping is done!\n"); movie->NumFrames = movie->Frames->Length; } if(ff == 1) { printf("Operation Fast Forward is done! Number of frames = %u.\n", FastImageList(movie->Frames, fFrame)); movie->NumFrames = movie->Frames->Length; } } /*printf("%d", movie->Frames->Length);*/ SaveMovie(fout, movie); DeleteMovie(movie); movie = NULL; free(fin); free(fout); fin = NULL; fout = NULL; return 0; }