diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-04-29 13:04:47 +0200 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-01 13:10:06 +0200 |
commit | 77e9dee8aefa3fca75984226f66bf004bb8f9e13 (patch) | |
tree | cd9590685f22841807a08105948faa115a6a31b1 /libavfilter | |
parent | 1ba57272429fc6c86e39cd236e2b32ac545e1488 (diff) | |
download | ffmpeg-77e9dee8aefa3fca75984226f66bf004bb8f9e13.tar.gz |
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.
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vsrc_buffer.c | 10 | ||||
-rw-r--r-- | libavfilter/vsrc_buffer.h | 4 | ||||
-rw-r--r-- | libavfilter/vsrc_movie.c | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c index c683d51e6f..48c2f23509 100644 --- a/libavfilter/vsrc_buffer.c +++ b/libavfilter/vsrc_buffer.c @@ -39,7 +39,7 @@ typedef struct { } BufferSourceContext; int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, - int64_t pts, AVRational pixel_aspect, int width, + int64_t pts, int width, int height, enum PixelFormat pix_fmt, const char *sws_param) { @@ -104,20 +104,20 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, c->frame.top_field_first = frame->top_field_first; c->frame.key_frame = frame->key_frame; c->frame.pict_type = frame->pict_type; + c->frame.sample_aspect_ratio = frame->sample_aspect_ratio; c->pts = pts; - c->pixel_aspect = pixel_aspect; c->has_frame = 1; return 0; } int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, - int64_t pts, AVRational pixel_aspect) + int64_t pts) { BufferSourceContext *c = buffer_filter->priv; return av_vsrc_buffer_add_frame2(buffer_filter, frame, - pts, pixel_aspect, c->w, + pts, c->w, c->h, c->pix_fmt, ""); } @@ -190,7 +190,7 @@ static int request_frame(AVFilterLink *link) picref->format, link->w, link->h); picref->pts = c->pts; - picref->video->pixel_aspect = c->pixel_aspect; + picref->video->pixel_aspect = c->frame.sample_aspect_ratio; picref->video->interlaced = c->frame.interlaced_frame; picref->video->top_field_first = c->frame.top_field_first; picref->video->key_frame = c->frame.key_frame; diff --git a/libavfilter/vsrc_buffer.h b/libavfilter/vsrc_buffer.h index 79a9908c69..68f7847890 100644 --- a/libavfilter/vsrc_buffer.h +++ b/libavfilter/vsrc_buffer.h @@ -31,10 +31,10 @@ #include "avfilter.h" int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, - int64_t pts, AVRational pixel_aspect); + int64_t pts); int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, - int64_t pts, AVRational pixel_aspect, int width, + int64_t pts, int width, int height, enum PixelFormat pix_fmt, const char *sws_param); diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c index e6b50850f2..dd3feaea98 100644 --- a/libavfilter/vsrc_movie.c +++ b/libavfilter/vsrc_movie.c @@ -247,8 +247,8 @@ static int movie_get_frame(AVFilterLink *outlink) movie->frame->pkt_dts : movie->frame->pkt_pts; movie->picref->pos = movie->frame->pkt_pos; - movie->picref->video->pixel_aspect = st->sample_aspect_ratio.num ? - st->sample_aspect_ratio : movie->codec_ctx->sample_aspect_ratio; + if (!movie->frame->sample_aspect_ratio.num) + movie->picref->video->pixel_aspect = st->sample_aspect_ratio; movie->picref->video->interlaced = movie->frame->interlaced_frame; movie->picref->video->top_field_first = movie->frame->top_field_first; movie->picref->video->key_frame = movie->frame->key_frame; |