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 libavfilter/vsrc_buffer.c (1 of 10 files). Show all
Unified · Split
| @@ -39,7 +39,7 @@ typedef struct { · 38 unmodified lines | ||
| 39 | 39 | } BufferSourceContext; |
| 40 | 40 | |
| 41 | 41 | int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, |
| 42 | − int64_t pts, AVRational pixel_aspect, int width, | |
| 42 | + int64_t pts, int width, | |
| 43 | 43 | int height, enum PixelFormat pix_fmt, |
| 44 | 44 | const char *sws_param) |
| 45 | 45 | { |
| @@ -104,20 +104,20 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, · 58 unmodified lines | ||
| 104 | 104 | c->frame.top_field_first = frame->top_field_first; |
| 105 | 105 | c->frame.key_frame = frame->key_frame; |
| 106 | 106 | c->frame.pict_type = frame->pict_type; |
| 107 | + c->frame.sample_aspect_ratio = frame->sample_aspect_ratio; | |
| 107 | 108 | c->pts = pts; |
| 108 | − c->pixel_aspect = pixel_aspect; | |
| 109 | 109 | c->has_frame = 1; |
| 110 | 110 | |
| 111 | 111 | return 0; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, |
| 115 | − int64_t pts, AVRational pixel_aspect) | |
| 115 | + int64_t pts) | |
| 116 | 116 | { |
| 117 | 117 | BufferSourceContext *c = buffer_filter->priv; |
| 118 | 118 | |
| 119 | 119 | return av_vsrc_buffer_add_frame2(buffer_filter, frame, |
| 120 | − pts, pixel_aspect, c->w, | |
| 120 | + pts, c->w, | |
| 121 | 121 | c->h, c->pix_fmt, ""); |
| 122 | 122 | } |
| 123 | 123 | |
| @@ -190,7 +190,7 @@ static int request_frame(AVFilterLink *link) · 66 unmodified lines | ||
| 190 | 190 | picref->format, link->w, link->h); |
| 191 | 191 | |
| 192 | 192 | picref->pts = c->pts; |
| 193 | − picref->video->pixel_aspect = c->pixel_aspect; | |
| 193 | + picref->video->pixel_aspect = c->frame.sample_aspect_ratio; | |
| 194 | 194 | picref->video->interlaced = c->frame.interlaced_frame; |
| 195 | 195 | picref->video->top_field_first = c->frame.top_field_first; |
| 196 | 196 | picref->video->key_frame = c->frame.key_frame; |