lavfi: rename AVFilterBufferRefVideoProps.pixel_aspect to sample_aspect_ratio

Improve consistency with libavcodec.

This breaks libavfilter API/ABI.

The non-sequential 2.1.0 -> 2.4.0 bump is due to the mess previously
done with the lavfi minor number.
This commit is contained in:
Stefano Sabatini 2011-04-29 13:12:39 +02:00
parent 77e9dee8ae
commit 35fe66abbc
14 changed files with 30 additions and 25 deletions

View File

@ -912,7 +912,7 @@ int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
frame->top_field_first = picref->video->top_field_first;
frame->key_frame = picref->video->key_frame;
frame->pict_type = picref->video->pict_type;
frame->sample_aspect_ratio = picref->video->pixel_aspect;
frame->sample_aspect_ratio = picref->video->sample_aspect_ratio;
return 1;
}

View File

@ -13,6 +13,10 @@ libavutil: 2011-04-18
API changes, most recent first:
2011-05-01 - xxxxxxx - lavfi 2.4.0 - avfilter.h
Rename AVFilterBufferRefVideoProps.pixel_aspect to
sample_aspect_ratio.
2011-05-01 - xxxxxxx - lavc 53.3.0 - AVFrame
Add a sample_aspect_ratio field to AVFrame.

View File

@ -1696,7 +1696,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
case AVMEDIA_TYPE_VIDEO:
#if CONFIG_AVFILTER
if (ost->picref->video && !ost->frame_aspect_ratio)
ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect;
ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio;
#endif
do_video_out(os, ost, ist, &picture, &frame_size);
if (vstats_filename && frame_size)

View File

@ -692,10 +692,10 @@ static void video_image_display(VideoState *is)
vp = &is->pictq[is->pictq_rindex];
if (vp->bmp) {
#if CONFIG_AVFILTER
if (vp->picref->video->pixel_aspect.num == 0)
if (vp->picref->video->sample_aspect_ratio.num == 0)
aspect_ratio = 0;
else
aspect_ratio = av_q2d(vp->picref->video->pixel_aspect);
aspect_ratio = av_q2d(vp->picref->video->sample_aspect_ratio);
#else
/* XXX: use variable in the frame */
@ -1688,7 +1688,7 @@ static int input_request_frame(AVFilterLink *link)
picref->pts = pts;
picref->pos = priv->frame->pkt_pos;
picref->video->pixel_aspect = priv->frame->sample_aspect_ratio;
picref->video->sample_aspect_ratio = priv->frame->sample_aspect_ratio;
avfilter_start_frame(link, picref);
avfilter_draw_slice(link, 0, link->h, 1);
avfilter_end_frame(link);

View File

@ -238,7 +238,7 @@ static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
if (ref->video) {
av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
ref->video->sample_aspect_ratio.num, ref->video->sample_aspect_ratio.den,
ref->video->w, ref->video->h,
!ref->video->interlaced ? 'P' : /* Progressive */
ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */

View File

@ -26,7 +26,7 @@
#include "libavutil/samplefmt.h"
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 1
#define LIBAVFILTER_VERSION_MINOR 4
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@ -112,7 +112,7 @@ typedef struct AVFilterBufferRefAudioProps {
typedef struct AVFilterBufferRefVideoProps {
int w; ///< image width
int h; ///< image height
AVRational pixel_aspect; ///< pixel aspect ratio
AVRational sample_aspect_ratio; ///< sample aspect ratio
int interlaced; ///< is frame interlaced
int top_field_first; ///< field order
enum AVPictureType pict_type; ///< picture type of the frame

View File

@ -65,7 +65,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
{
AspectContext *aspect = link->dst->priv;
picref->video->pixel_aspect = aspect->aspect;
picref->video->sample_aspect_ratio = aspect->aspect;
avfilter_start_frame(link->dst->outputs[0], picref);
}

View File

@ -430,7 +430,7 @@ static int source_request_frame(AVFilterLink *outlink)
{
Frei0rContext *frei0r = outlink->src->priv;
AVFilterBufferRef *picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
picref->video->pixel_aspect = (AVRational) {1, 1};
picref->video->sample_aspect_ratio = (AVRational) {1, 1};
picref->pts = frei0r->pts++;
picref->pos = -1;

View File

@ -252,9 +252,9 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
outlink->out_buf = outpicref;
av_reduce(&outpicref->video->pixel_aspect.num, &outpicref->video->pixel_aspect.den,
(int64_t)picref->video->pixel_aspect.num * outlink->h * link->w,
(int64_t)picref->video->pixel_aspect.den * outlink->w * link->h,
av_reduce(&outpicref->video->sample_aspect_ratio.num, &outpicref->video->sample_aspect_ratio.den,
(int64_t)picref->video->sample_aspect_ratio.num * outlink->h * link->w,
(int64_t)picref->video->sample_aspect_ratio.den * outlink->w * link->h,
INT_MAX);
scale->slice_y = 0;

View File

@ -59,7 +59,7 @@ static void end_frame(AVFilterLink *inlink)
showinfo->frame,
picref->pts, picref ->pts * av_q2d(inlink->time_base), picref->pos,
av_pix_fmt_descriptors[picref->format].name,
picref->video->pixel_aspect.num, picref->video->pixel_aspect.den,
picref->video->sample_aspect_ratio.num, picref->video->sample_aspect_ratio.den,
picref->video->w, picref->video->h,
!picref->video->interlaced ? 'P' : /* Progressive */
picref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */

View File

@ -122,11 +122,11 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
outlink->w, outlink->h);
outlink->out_buf->pts = picref->pts;
if (picref->video->pixel_aspect.num == 0) {
outlink->out_buf->video->pixel_aspect = picref->video->pixel_aspect;
if (picref->video->sample_aspect_ratio.num == 0) {
outlink->out_buf->video->sample_aspect_ratio = picref->video->sample_aspect_ratio;
} else {
outlink->out_buf->video->pixel_aspect.num = picref->video->pixel_aspect.den;
outlink->out_buf->video->pixel_aspect.den = picref->video->pixel_aspect.num;
outlink->out_buf->video->sample_aspect_ratio.num = picref->video->sample_aspect_ratio.den;
outlink->out_buf->video->sample_aspect_ratio.den = picref->video->sample_aspect_ratio.num;
}
avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));

View File

@ -34,7 +34,7 @@ typedef struct {
int h, w;
enum PixelFormat pix_fmt;
AVRational time_base; ///< time_base to set in the output link
AVRational pixel_aspect;
AVRational sample_aspect_ratio;
char sws_param[256];
} BufferSourceContext;
@ -130,7 +130,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if (!args ||
(n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str,
&c->time_base.num, &c->time_base.den,
&c->pixel_aspect.num, &c->pixel_aspect.den)) != 7) {
&c->sample_aspect_ratio.num, &c->sample_aspect_ratio.den)) != 7) {
av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but only %d found in '%s'\n", n, args);
return AVERROR(EINVAL);
}
@ -162,7 +162,7 @@ static int config_props(AVFilterLink *link)
link->w = c->w;
link->h = c->h;
link->sample_aspect_ratio = c->pixel_aspect;
link->sample_aspect_ratio = c->sample_aspect_ratio;
link->time_base = c->time_base;
return 0;
@ -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->frame.sample_aspect_ratio;
picref->video->sample_aspect_ratio = 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;

View File

@ -132,7 +132,7 @@ static int color_request_frame(AVFilterLink *link)
{
ColorContext *color = link->src->priv;
AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h);
picref->video->pixel_aspect = (AVRational) {1, 1};
picref->video->sample_aspect_ratio = (AVRational) {1, 1};
picref->pts = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q);
picref->pos = 0;

View File

@ -248,7 +248,7 @@ static int movie_get_frame(AVFilterLink *outlink)
movie->picref->pos = movie->frame->pkt_pos;
if (!movie->frame->sample_aspect_ratio.num)
movie->picref->video->pixel_aspect = st->sample_aspect_ratio;
movie->picref->video->sample_aspect_ratio = 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;
@ -258,7 +258,8 @@ static int movie_get_frame(AVFilterLink *outlink)
movie->file_name, movie->picref->pts,
(double)movie->picref->pts * av_q2d(st->time_base),
movie->picref->pos,
movie->picref->video->pixel_aspect.num, movie->picref->video->pixel_aspect.den);
movie->picref->video->sample_aspect_ratio.num,
movie->picref->video->sample_aspect_ratio.den);
// We got it. Free the packet since we are returning
av_free_packet(&pkt);