#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INBUF_SIZE 4096
char *filename)
{
FILE *f;
int i;
f = fopen(filename,"w");
fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255);
for (i = 0; i < ysize; i++)
fwrite(buf + i * wrap, 1, xsize, f);
fclose(f);
}
{
if (len < 0) {
fprintf(stderr, "Error while decoding frame %d\n", *frame_count);
}
if (got_frame) {
printf("Saving %sframe %3d\n", last ? "last " : "", *frame_count);
fflush(stdout);
snprintf(buf,
sizeof(buf),
"%s-%d", outfilename, *frame_count);
(*frame_count)++;
}
}
return 0;
}
int main(
int argc,
char **argv)
{
const char *filename, *outfilename;
int frame_count;
FILE *f;
if (argc <= 2) {
fprintf(stderr, "Usage: %s <input file> <output file>\n", argv[0]);
exit(0);
}
filename = argv[1];
outfilename = argv[2];
if (!codec) {
fprintf(stderr, "Codec not found\n");
exit(1);
}
if (!c) {
fprintf(stderr, "Could not allocate video codec context\n");
exit(1);
}
fprintf(stderr, "Could not open codec\n");
exit(1);
}
f = fopen(filename, "rb");
if (!f) {
fprintf(stderr, "Could not open %s\n", filename);
exit(1);
}
if (!frame) {
fprintf(stderr, "Could not allocate video frame\n");
exit(1);
}
frame_count = 0;
for (;;) {
break;
exit(1);
}
fclose(f);
return 0;
}