diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-09-13 10:09:44 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-09-13 20:49:59 +0200 |
commit | bcf93f78a55e5ee9731d1930c67a1fff690594e1 (patch) | |
tree | 0009df42503e4cda08a28c5de6d146849e2ce9e5 /doc/examples | |
parent | 70b671a2835a96ed04388aa33f62ba63fed70465 (diff) | |
download | ffmpeg-bcf93f78a55e5ee9731d1930c67a1fff690594e1.tar.gz |
examples/decoding_encoding: replace "picture" with "frame" in encode_example()
The use of "picture" in place of "frame" is confusing.
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/decoding_encoding.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c index cd59240b3f..7dda74021c 100644 --- a/doc/examples/decoding_encoding.c +++ b/doc/examples/decoding_encoding.c @@ -332,7 +332,7 @@ static void video_encode_example(const char *filename, int codec_id) AVCodecContext *c= NULL; int i, ret, x, y, got_output; FILE *f; - AVFrame *picture; + AVFrame *frame; AVPacket pkt; uint8_t endcode[] = { 0, 0, 1, 0xb7 }; @@ -373,18 +373,18 @@ static void video_encode_example(const char *filename, int codec_id) exit(1); } - picture = avcodec_alloc_frame(); - if (!picture) { + frame = avcodec_alloc_frame(); + if (!frame) { fprintf(stderr, "Could not allocate video frame\n"); exit(1); } - picture->format = c->pix_fmt; - picture->width = c->width; - picture->height = c->height; + frame->format = c->pix_fmt; + frame->width = c->width; + frame->height = c->height; /* the image can be allocated by any means and av_image_alloc() is * just the most convenient way if av_malloc() is to be used */ - ret = av_image_alloc(picture->data, picture->linesize, c->width, c->height, + ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height, c->pix_fmt, 32); if (ret < 0) { fprintf(stderr, "Could not allocate raw picture buffer\n"); @@ -402,22 +402,22 @@ static void video_encode_example(const char *filename, int codec_id) /* 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; + frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; } } /* 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; + frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; + frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; } } - picture->pts = i; + frame->pts = i; /* encode the image */ - ret = avcodec_encode_video2(c, &pkt, picture, &got_output); + ret = avcodec_encode_video2(c, &pkt, frame, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); @@ -453,8 +453,8 @@ static void video_encode_example(const char *filename, int codec_id) avcodec_close(c); av_free(c); - av_freep(&picture->data[0]); - av_free(picture); + av_freep(&frame->data[0]); + av_free(frame); printf("\n"); } |