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
10111011 * - decoding: Read by user.\
10121012 */\
10131013 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;\
10141021
10151022
10161023 #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
455455 pic->pts = pic->best_effort_timestamp = AV_NOPTS_VALUE;
456456 pic->pkt_pos = -1;
457457 pic->key_frame= 1;
458+ pic->sample_aspect_ratio = (AVRational){0, 1};
458459 }
459460
460461 AVFrame *avcodec_alloc_frame(void){
@@ -737,6 +738,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi · 276 unmodified lines
737738 avpkt);
738739 picture->pkt_dts= avpkt->dts;
739740 picture->pkt_pos= avpkt->pos;
741+ if (!picture->sample_aspect_ratio.num)
742+ picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
740743 }
741744
742745 emms_c(); //needed to avoid an emms_c() call before every return;
libavcodec/version.h+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #define AVCODEC_VERSION_H
2222
2323 #define LIBAVCODEC_VERSION_MAJOR 53
24−#define LIBAVCODEC_VERSION_MINOR 2
24+#define LIBAVCODEC_VERSION_MINOR 3
2525 #define LIBAVCODEC_VERSION_MICRO 0
2626
2727 #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