nuclear@0: #include nuclear@0: #include nuclear@0: #include nuclear@0: #include nuclear@0: #include nuclear@0: #include nuclear@0: nuclear@0: int parse_opt(int argc, char **argv); nuclear@0: nuclear@0: char *inpat, *outpat = "out%4d.png"; nuclear@0: int range_min, range_max = INT_MAX; nuclear@0: float fps = 30; nuclear@0: char *plugin_name; nuclear@0: nuclear@0: void *dl; nuclear@0: int (*init)(void); nuclear@0: void (*shutdown)(void); nuclear@0: int (*process)(struct img_pixmap*, int, float); nuclear@0: nuclear@0: int main(int argc, char **argv) nuclear@0: { nuclear@0: char *fname; nuclear@0: int i, frame_width = -1, frame_height; nuclear@0: nuclear@0: if(parse_opt(argc, argv) == -1) { nuclear@0: return 1; nuclear@0: } nuclear@0: nuclear@0: if(!(dl = dlopen(plugin_name, RTLD_LAZY))) { nuclear@0: fprintf(stderr, "failed to open post plugin: %s: %s\n", plugin_name, dlerror()); nuclear@0: return 1; nuclear@0: } nuclear@0: init = dlsym(dl, "init"); nuclear@0: shutdown = dlsym(dl, "shutdown"); nuclear@0: if(!(process = dlsym(dl, "process"))) { nuclear@0: fprintf(stderr, "invalid post plugin, failed to load process func: %s\n", dlerror()); nuclear@0: return 1; nuclear@0: } nuclear@0: nuclear@0: if(init) { nuclear@0: if(init() == -1) { nuclear@0: fprintf(stderr, "init failed\n"); nuclear@0: return 1; nuclear@0: } nuclear@0: } nuclear@0: nuclear@0: fname = alloca(strlen(inpat) + 11); nuclear@0: nuclear@0: for(i=range_min; i [%s] -> %s\n", inpat, plugin_name, outpat); nuclear@0: /*if(range_min > 0 || range_max < INT_MAX) {*/ nuclear@0: printf("frames: [%d, ", range_min); nuclear@0: if(range_max < INT_MAX) { nuclear@0: printf("%d]\n", range_max); nuclear@0: } else { nuclear@0: printf("inf]\n"); nuclear@0: } nuclear@0: /*}*/ nuclear@0: printf("framerate: %f fps\n", fps); nuclear@0: nuclear@0: return 0; nuclear@0: nuclear@0: invalid: nuclear@0: fprintf(stderr, "invalid argument: %s\n", argv[i]); nuclear@0: return -1; nuclear@0: }