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

Stefano Sabatini git at videolan.org
Sat May 7 12:09:26 CEST 2011


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

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=22333a6b19f59ebc83933b910069d00c445d01ed
---

 doc/APIchanges            |    3 +++
 libavcodec/avcodec.h      |    7 +++++++
 libavcodec/utils.c        |    4 ++++
 libavcodec/version.h      |    2 +-
 libavfilter/vsrc_buffer.c |    2 ++
 5 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index ab91c24..a17922e 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:   2011-04-18
 
 API changes, most recent first:
 
+2011-05-07 - xxxxxxx - lavc 53.4.0 - AVFrame
+  Add width and height fields to AVFrame.
+
 2011-05-01 - xxxxxxx - lavfi 2.4.0 - avfilter.h
   Rename AVFilterBufferRefVideoProps.pixel_aspect to
   sample_aspect_ratio.
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 11af5ea..e26fcc2 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1018,6 +1018,13 @@ typedef struct AVPanScan{
      * - decoding: Read by user.\
      */\
     AVRational sample_aspect_ratio;\
+\
+    /**\
+     * width and height of the video frame\
+     * - encoding: unused\
+     * - decoding: Read by user.\
+     */\
+    int width, height;\
 
 
 #define FF_QSCALE_TYPE_MPEG1 0
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index fd1c090..dc26092 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -739,6 +739,10 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
             picture->pkt_pos= avpkt->pos;
             if (!picture->sample_aspect_ratio.num)
                 picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
+            if (!picture->width)
+                picture->width = avctx->width;
+            if (!picture->height)
+                picture->height = avctx->height;
         }
 
         emms_c(); //needed to avoid an emms_c() call before every return;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 4b8e70f..362c4f1 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -21,7 +21,7 @@
 #define AVCODEC_VERSION_H
 
 #define LIBAVCODEC_VERSION_MAJOR 53
-#define LIBAVCODEC_VERSION_MINOR  3
+#define LIBAVCODEC_VERSION_MINOR  4
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c
index ea63f7d..8445671 100644
--- a/libavfilter/vsrc_buffer.c
+++ b/libavfilter/vsrc_buffer.c
@@ -102,6 +102,8 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame,
 
     memcpy(c->frame.data    , frame->data    , sizeof(frame->data));
     memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize));
+    c->frame.width  = frame->width;
+    c->frame.height = frame->height;
     c->frame.interlaced_frame= frame->interlaced_frame;
     c->frame.top_field_first = frame->top_field_first;
     c->frame.key_frame = frame->key_frame;



More information about the ffmpeg-cvslog mailing list