#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(
int argc,
char **argv)
{
const char *filename, *codec_name;
int i, ret, x, y, got_output;
FILE *f;
uint8_t endcode[] = { 0, 0, 1, 0xb7 };
if (argc <= 2) {
fprintf(stderr, "Usage: %s <output file> <codec name>\n", argv[0]);
exit(0);
}
filename = argv[1];
codec_name = 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, "wb");
if (!f) {
fprintf(stderr, "Could not open %s\n", filename);
exit(1);
}
if (!frame) {
fprintf(stderr, "Could not allocate video frame\n");
exit(1);
}
if (ret < 0) {
fprintf(stderr, "Could not allocate the video frame data\n");
exit(1);
}
for (i = 0; i < 25; i++) {
fflush(stdout);
if (ret < 0)
exit(1);
for (y = 0; y < c->
height; y++) {
for (x = 0; x < c->
width; x++) {
}
}
for (y = 0; y < c->
height/2; y++) {
for (x = 0; x < c->
width/2; x++) {
frame->
data[1][y * frame->
linesize[1] + x] = 128 + y + i * 2;
frame->
data[2][y * frame->
linesize[2] + x] = 64 + x + i * 5;
}
}
if (ret < 0) {
fprintf(stderr, "Error encoding frame\n");
exit(1);
}
if (got_output) {
printf(
"Write frame %3d (size=%5d)\n", i, pkt.
size);
}
}
for (got_output = 1; got_output; i++) {
fflush(stdout);
if (ret < 0) {
fprintf(stderr, "Error encoding frame\n");
exit(1);
}
if (got_output) {
printf(
"Write frame %3d (size=%5d)\n", i, pkt.
size);
}
}
fwrite(endcode, 1, sizeof(endcode), f);
fclose(f);
return 0;
}