[FFmpeg-cvslog] examples/decoding_encoding: replace "picture" with "frame" in encode_example()

Stefano Sabatini git at videolan.org
Thu Sep 13 20:50:59 CEST 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Thu Sep 13 10:09:44 2012 +0200| [bcf93f78a55e5ee9731d1930c67a1fff690594e1] | committer: Stefano Sabatini

examples/decoding_encoding: replace "picture" with "frame" in encode_example()

The use of "picture" in place of "frame" is confusing.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bcf93f78a55e5ee9731d1930c67a1fff690594e1
---

 doc/examples/decoding_encoding.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c
index cd59240..7dda740 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");
 }
 



More information about the ffmpeg-cvslog mailing list