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.
Showing the changes to libavcodec (3 of 10 files). Show all
Unified · Split
| @@ -1011,6 +1011,13 @@ typedef struct AVPanScan{ · 1010 unmodified lines | |||
| 1011 | * - decoding: Read by user.\ | 1011 | * - decoding: Read by user.\ |
| 1012 | */\ | 1012 | */\ |
| 1013 | int64_t pkt_pos;\ | 1013 | int64_t pkt_pos;\ |
| 1014 | \ | ||
| 1015 | /**\ | ||
| 1016 | * reordered sample aspect ratio for the video frame, 0/1 if unknown\unspecified | ||
| 1017 | * - encoding: unused\ | ||
| 1018 | * - decoding: Read by user.\ | ||
| 1019 | */\ | ||
| 1020 | AVRational sample_aspect_ratio;\ | ||
| 1014 | 1021 | ||
| 1015 | 1022 | ||
| 1016 | #define FF_QSCALE_TYPE_MPEG1 0 | 1023 | #define FF_QSCALE_TYPE_MPEG1 0 |
| @@ -455,6 +455,7 @@ void avcodec_get_frame_defaults(AVFrame *pic){ · 454 unmodified lines | |||
| 455 | pic->pts = pic->best_effort_timestamp = AV_NOPTS_VALUE; | 455 | pic->pts = pic->best_effort_timestamp = AV_NOPTS_VALUE; |
| 456 | pic->pkt_pos = -1; | 456 | pic->pkt_pos = -1; |
| 457 | pic->key_frame= 1; | 457 | pic->key_frame= 1; |
| 458 | pic->sample_aspect_ratio = (AVRational){0, 1}; | ||
| 458 | } | 459 | } |
| 459 | 460 | ||
| 460 | AVFrame *avcodec_alloc_frame(void){ | 461 | AVFrame *avcodec_alloc_frame(void){ |
| @@ -737,6 +738,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi · 276 unmodified lines | |||
| 737 | avpkt); | 738 | avpkt); |
| 738 | picture->pkt_dts= avpkt->dts; | 739 | picture->pkt_dts= avpkt->dts; |
| 739 | picture->pkt_pos= avpkt->pos; | 740 | picture->pkt_pos= avpkt->pos; |
| 741 | if (!picture->sample_aspect_ratio.num) | ||
| 742 | picture->sample_aspect_ratio = avctx->sample_aspect_ratio; | ||
| 740 | } | 743 | } |
| 741 | 744 | ||
| 742 | emms_c(); //needed to avoid an emms_c() call before every return; | 745 | emms_c(); //needed to avoid an emms_c() call before every return; |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | #define AVCODEC_VERSION_H | 21 | #define AVCODEC_VERSION_H |
| 22 | 22 | ||
| 23 | #define LIBAVCODEC_VERSION_MAJOR 53 | 23 | #define LIBAVCODEC_VERSION_MAJOR 53 |
| 24 | #define LIBAVCODEC_VERSION_MINOR 2 | 24 | #define LIBAVCODEC_VERSION_MINOR 3 |
| 25 | #define LIBAVCODEC_VERSION_MICRO 0 | 25 | #define LIBAVCODEC_VERSION_MICRO 0 |
| 26 | 26 | ||
| 27 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 27 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |