[FFmpeg-cvslog] lavc: add width and height fields to AVFrame

Stefano Sabatini git at videolan.org
Mon Dec 26 04:14:00 CET 2011


ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Sun May  1 14:02:08 2011 +0200| [3a2ddf7c2c4d27b595a601c55af23129a5a8be0d] | committer: Anton Khirnov

lavc: add width and height fields to AVFrame

width and height are per-frame properties, setting these values in
AVFrame simplify the operation of extraction of that information,
since avoids the need to check the codec/stream context.

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

 libavcodec/avcodec.h |    7 +++++++
 libavcodec/pthread.c |    2 ++
 libavcodec/utils.c   |    2 ++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index eb6826b..0204af7 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1265,6 +1265,13 @@ typedef struct AVFrame {
      * - decoding: Read by user.
      */
     AVRational sample_aspect_ratio;
+
+    /**
+     * width and height of the video frame
+     * - encoding: unused
+     * - decoding: Read by user.
+     */
+    int width, height;
 } AVFrame;
 
 struct AVCodecInternal;
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 17dd12d..1ec2d1a 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -600,6 +600,8 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
         *got_picture_ptr = p->got_frame;
         picture->pkt_dts = p->avpkt.dts;
         picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
+        picture->width  = avctx->width;
+        picture->height = avctx->height;
 
         /*
          * A later call with avkpt->size == 0 may loop over all threads,
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 7c1a7ae..74932ed 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -860,6 +860,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
                               avpkt);
             picture->pkt_dts= avpkt->dts;
             picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
+            picture->width  = avctx->width;
+            picture->height = avctx->height;
         }
 
         emms_c(); //needed to avoid an emms_c() call before every return;



More information about the ffmpeg-cvslog mailing list