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.
This commit is contained in:
parent
b58dbb5b03
commit
3a2ddf7c2c
@ -1265,6 +1265,13 @@ typedef struct AVFrame {
|
|||||||
* - decoding: Read by user.
|
* - decoding: Read by user.
|
||||||
*/
|
*/
|
||||||
AVRational sample_aspect_ratio;
|
AVRational sample_aspect_ratio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* width and height of the video frame
|
||||||
|
* - encoding: unused
|
||||||
|
* - decoding: Read by user.
|
||||||
|
*/
|
||||||
|
int width, height;
|
||||||
} AVFrame;
|
} AVFrame;
|
||||||
|
|
||||||
struct AVCodecInternal;
|
struct AVCodecInternal;
|
||||||
|
@ -600,6 +600,8 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
|
|||||||
*got_picture_ptr = p->got_frame;
|
*got_picture_ptr = p->got_frame;
|
||||||
picture->pkt_dts = p->avpkt.dts;
|
picture->pkt_dts = p->avpkt.dts;
|
||||||
picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
|
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,
|
* A later call with avkpt->size == 0 may loop over all threads,
|
||||||
|
@ -860,6 +860,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
|
|||||||
avpkt);
|
avpkt);
|
||||||
picture->pkt_dts= avpkt->dts;
|
picture->pkt_dts= avpkt->dts;
|
||||||
picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
|
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;
|
emms_c(); //needed to avoid an emms_c() call before every return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user