aboutsummaryrefslogtreecommitdiff
path: root/src/creator.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/creator.c')
-rw-r--r--src/creator.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/creator.c b/src/creator.c
index d8bd008..85fd0b0 100644
--- a/src/creator.c
+++ b/src/creator.c
@@ -24,7 +24,7 @@ static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
av_packet_unref(pkt);
}
}
-int generateVideo(filename, int width, int height, int fps, int bitRate)
+int generateVideo(char *filename, int width, int height, int fps, int bitRate)
{
avcodec_register_all();
@@ -77,36 +77,38 @@ int generateVideo(filename, int width, int height, int fps, int bitRate)
fprintf(stderr, "could not alloc the frame data\n");
exit(1);
}
+ return TRUE;
+}
void addFrame(int *frame)
{
- fflush(stdout);
- /* make sure the frame data is writable */
- ret = av_frame_make_writable(picture);
- if (ret < 0)
- exit(1);
+ fflush(stdout);
+ /* make sure the frame data is writable */
+ ret = av_frame_make_writable(picture);
+ if (ret < 0)
+ exit(1);
- picture->data[0] = frame;
+ picture->data[0] = frame;
- /* prepare a dummy image */
- /* Y */
- /*for(y=0;y<c->height;y++) {
- for(x=0;x<c->width;x++) {
- picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;
- }
- } YCbCr colorCode
- /* Cb and Cr *
- for(y=0;y<c->height/2;y++) {
- for(x=0;x<c->width/2;x++) {
- picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;
- picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;
- }
- } */
+ /* prepare a dummy image */
+ /* Y */
+ /*for(y=0;y<c->height;y++) {
+ for(x=0;x<c->width;x++) {
+ picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;
+ }
+ } YCbCr colorCode
+ /* Cb and Cr *
+ for(y=0;y<c->height/2;y++) {
+ for(x=0;x<c->width/2;x++) {
+ picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;
+ picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;
+ }
+ } */
- picture->pts = i;
- /* encode the image */
- encode(c, picture, pkt, f);
+ picture->pts = i;
+ /* encode the image */
+ encode(c, picture, pkt, f);
}
void endFile(void){