History

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.

Stefano Sabatini committed 15 years ago

Commit 77e9dee1 parent 1ba572710 files · +28 −15Browse files

Showing the changes to libavcodec (3 of 10 files). Show all

Unified · Split

3 files
  1. libavcodec/avcodec.h +7 −0
  2. libavcodec/utils.c +3 −0
  3. libavcodec/version.h +1 −1
libavcodec/avcodec.h+7−0
@@ -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 01023#define FF_QSCALE_TYPE_MPEG1 0
libavcodec/utils.c+3−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
460AVFrame *avcodec_alloc_frame(void){461AVFrame *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;
libavcodec/version.h+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
21#define AVCODEC_VERSION_H21#define AVCODEC_VERSION_H
22 22
23#define LIBAVCODEC_VERSION_MAJOR 5323#define LIBAVCODEC_VERSION_MAJOR 53
24#define LIBAVCODEC_VERSION_MINOR 224#define LIBAVCODEC_VERSION_MINOR 3
25#define LIBAVCODEC_VERSION_MICRO 025#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, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t