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.
This commit is contained in:
parent
1ba5727242
commit
77e9dee8ae
10 changed files with 28 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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, \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue