diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-04-29 13:04:47 +0200 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-01 13:10:06 +0200 |
commit | 77e9dee8aefa3fca75984226f66bf004bb8f9e13 (patch) | |
tree | cd9590685f22841807a08105948faa115a6a31b1 /libavcodec | |
parent | 1ba57272429fc6c86e39cd236e2b32ac545e1488 (diff) | |
download | ffmpeg-77e9dee8aefa3fca75984226f66bf004bb8f9e13.tar.gz |
lavc: add a sample_aspect_ratio field to AVFrame
The sample aspect ratio is a per-frame property, so it makes sense to
define it in AVFrame rather than in the codec/stream context.
Simplify application-level sample aspect ratio information extraction,
and allow further simplifications.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 7 | ||||
-rw-r--r-- | libavcodec/utils.c | 3 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 251a038d2b..3f8f1a6ebc 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1011,6 +1011,13 @@ typedef struct AVPanScan{ * - decoding: Read by user.\ */\ int64_t pkt_pos;\ +\ + /**\ + * reordered sample aspect ratio for the video frame, 0/1 if unknown\unspecified + * - encoding: unused\ + * - decoding: Read by user.\ + */\ + AVRational sample_aspect_ratio;\ #define FF_QSCALE_TYPE_MPEG1 0 diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 0993d52644..5977d3cf16 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -455,6 +455,7 @@ void avcodec_get_frame_defaults(AVFrame *pic){ pic->pts = pic->best_effort_timestamp = AV_NOPTS_VALUE; pic->pkt_pos = -1; pic->key_frame= 1; + pic->sample_aspect_ratio = (AVRational){0, 1}; } AVFrame *avcodec_alloc_frame(void){ @@ -737,6 +738,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi avpkt); picture->pkt_dts= avpkt->dts; picture->pkt_pos= avpkt->pos; + if (!picture->sample_aspect_ratio.num) + picture->sample_aspect_ratio = avctx->sample_aspect_ratio; } emms_c(); //needed to avoid an emms_c() call before every return; diff --git a/libavcodec/version.h b/libavcodec/version.h index c7c7456e96..4b8e70f314 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 2 +#define LIBAVCODEC_VERSION_MINOR 3 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |