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.tags/n0.8
| @@ -912,7 +912,7 @@ int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame, | |||||
| frame->top_field_first = picref->video->top_field_first; | frame->top_field_first = picref->video->top_field_first; | ||||
| frame->key_frame = picref->video->key_frame; | frame->key_frame = picref->video->key_frame; | ||||
| frame->pict_type = picref->video->pict_type; | 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; | return 1; | ||||
| } | } | ||||
| @@ -13,6 +13,10 @@ libavutil: 2011-04-18 | |||||
| API changes, most recent first: | 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 | 2011-05-01 - xxxxxxx - lavc 53.3.0 - AVFrame | ||||
| Add a sample_aspect_ratio field to AVFrame. | Add a sample_aspect_ratio field to AVFrame. | ||||
| @@ -1696,7 +1696,7 @@ static int output_packet(AVInputStream *ist, int ist_index, | |||||
| case AVMEDIA_TYPE_VIDEO: | case AVMEDIA_TYPE_VIDEO: | ||||
| #if CONFIG_AVFILTER | #if CONFIG_AVFILTER | ||||
| if (ost->picref->video && !ost->frame_aspect_ratio) | 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 | #endif | ||||
| do_video_out(os, ost, ist, &picture, &frame_size); | do_video_out(os, ost, ist, &picture, &frame_size); | ||||
| if (vstats_filename && frame_size) | if (vstats_filename && frame_size) | ||||
| @@ -692,10 +692,10 @@ static void video_image_display(VideoState *is) | |||||
| vp = &is->pictq[is->pictq_rindex]; | vp = &is->pictq[is->pictq_rindex]; | ||||
| if (vp->bmp) { | if (vp->bmp) { | ||||
| #if CONFIG_AVFILTER | #if CONFIG_AVFILTER | ||||
| if (vp->picref->video->pixel_aspect.num == 0) | |||||
| if (vp->picref->video->sample_aspect_ratio.num == 0) | |||||
| aspect_ratio = 0; | aspect_ratio = 0; | ||||
| else | else | ||||
| aspect_ratio = av_q2d(vp->picref->video->pixel_aspect); | |||||
| aspect_ratio = av_q2d(vp->picref->video->sample_aspect_ratio); | |||||
| #else | #else | ||||
| /* XXX: use variable in the frame */ | /* XXX: use variable in the frame */ | ||||
| @@ -1688,7 +1688,7 @@ static int input_request_frame(AVFilterLink *link) | |||||
| picref->pts = pts; | picref->pts = pts; | ||||
| picref->pos = priv->frame->pkt_pos; | 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_start_frame(link, picref); | ||||
| avfilter_draw_slice(link, 0, link->h, 1); | avfilter_draw_slice(link, 0, link->h, 1); | ||||
| avfilter_end_frame(link); | avfilter_end_frame(link); | ||||
| @@ -238,7 +238,7 @@ static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) | |||||
| if (ref->video) { | if (ref->video) { | ||||
| av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c", | 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->w, ref->video->h, | ||||
| !ref->video->interlaced ? 'P' : /* Progressive */ | !ref->video->interlaced ? 'P' : /* Progressive */ | ||||
| ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */ | ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */ | ||||
| @@ -26,7 +26,7 @@ | |||||
| #include "libavutil/samplefmt.h" | #include "libavutil/samplefmt.h" | ||||
| #define LIBAVFILTER_VERSION_MAJOR 2 | #define LIBAVFILTER_VERSION_MAJOR 2 | ||||
| #define LIBAVFILTER_VERSION_MINOR 1 | |||||
| #define LIBAVFILTER_VERSION_MINOR 4 | |||||
| #define LIBAVFILTER_VERSION_MICRO 0 | #define LIBAVFILTER_VERSION_MICRO 0 | ||||
| #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ | ||||
| @@ -112,7 +112,7 @@ typedef struct AVFilterBufferRefAudioProps { | |||||
| typedef struct AVFilterBufferRefVideoProps { | typedef struct AVFilterBufferRefVideoProps { | ||||
| int w; ///< image width | int w; ///< image width | ||||
| int h; ///< image height | int h; ///< image height | ||||
| AVRational pixel_aspect; ///< pixel aspect ratio | |||||
| AVRational sample_aspect_ratio; ///< sample aspect ratio | |||||
| int interlaced; ///< is frame interlaced | int interlaced; ///< is frame interlaced | ||||
| int top_field_first; ///< field order | int top_field_first; ///< field order | ||||
| enum AVPictureType pict_type; ///< picture type of the frame | enum AVPictureType pict_type; ///< picture type of the frame | ||||
| @@ -65,7 +65,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) | |||||
| { | { | ||||
| AspectContext *aspect = link->dst->priv; | 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); | avfilter_start_frame(link->dst->outputs[0], picref); | ||||
| } | } | ||||
| @@ -430,7 +430,7 @@ static int source_request_frame(AVFilterLink *outlink) | |||||
| { | { | ||||
| Frei0rContext *frei0r = outlink->src->priv; | Frei0rContext *frei0r = outlink->src->priv; | ||||
| AVFilterBufferRef *picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | 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->pts = frei0r->pts++; | ||||
| picref->pos = -1; | picref->pos = -1; | ||||
| @@ -252,9 +252,9 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) | |||||
| outlink->out_buf = outpicref; | 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); | INT_MAX); | ||||
| scale->slice_y = 0; | scale->slice_y = 0; | ||||
| @@ -59,7 +59,7 @@ static void end_frame(AVFilterLink *inlink) | |||||
| showinfo->frame, | showinfo->frame, | ||||
| picref->pts, picref ->pts * av_q2d(inlink->time_base), picref->pos, | picref->pts, picref ->pts * av_q2d(inlink->time_base), picref->pos, | ||||
| av_pix_fmt_descriptors[picref->format].name, | 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->w, picref->video->h, | ||||
| !picref->video->interlaced ? 'P' : /* Progressive */ | !picref->video->interlaced ? 'P' : /* Progressive */ | ||||
| picref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */ | picref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */ | ||||
| @@ -122,11 +122,11 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) | |||||
| outlink->w, outlink->h); | outlink->w, outlink->h); | ||||
| outlink->out_buf->pts = picref->pts; | 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 { | } 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)); | avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0)); | ||||
| @@ -34,7 +34,7 @@ typedef struct { | |||||
| int h, w; | int h, w; | ||||
| enum PixelFormat pix_fmt; | enum PixelFormat pix_fmt; | ||||
| AVRational time_base; ///< time_base to set in the output link | AVRational time_base; ///< time_base to set in the output link | ||||
| AVRational pixel_aspect; | |||||
| AVRational sample_aspect_ratio; | |||||
| char sws_param[256]; | char sws_param[256]; | ||||
| } BufferSourceContext; | } BufferSourceContext; | ||||
| @@ -130,7 +130,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | |||||
| if (!args || | if (!args || | ||||
| (n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str, | (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->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); | av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but only %d found in '%s'\n", n, args); | ||||
| return AVERROR(EINVAL); | return AVERROR(EINVAL); | ||||
| } | } | ||||
| @@ -162,7 +162,7 @@ static int config_props(AVFilterLink *link) | |||||
| link->w = c->w; | link->w = c->w; | ||||
| link->h = c->h; | 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; | link->time_base = c->time_base; | ||||
| return 0; | return 0; | ||||
| @@ -190,7 +190,7 @@ static int request_frame(AVFilterLink *link) | |||||
| picref->format, link->w, link->h); | picref->format, link->w, link->h); | ||||
| picref->pts = c->pts; | 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->interlaced = c->frame.interlaced_frame; | ||||
| picref->video->top_field_first = c->frame.top_field_first; | picref->video->top_field_first = c->frame.top_field_first; | ||||
| picref->video->key_frame = c->frame.key_frame; | picref->video->key_frame = c->frame.key_frame; | ||||
| @@ -132,7 +132,7 @@ static int color_request_frame(AVFilterLink *link) | |||||
| { | { | ||||
| ColorContext *color = link->src->priv; | ColorContext *color = link->src->priv; | ||||
| AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); | 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->pts = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q); | ||||
| picref->pos = 0; | picref->pos = 0; | ||||
| @@ -248,7 +248,7 @@ static int movie_get_frame(AVFilterLink *outlink) | |||||
| movie->picref->pos = movie->frame->pkt_pos; | movie->picref->pos = movie->frame->pkt_pos; | ||||
| if (!movie->frame->sample_aspect_ratio.num) | 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->interlaced = movie->frame->interlaced_frame; | ||||
| movie->picref->video->top_field_first = movie->frame->top_field_first; | movie->picref->video->top_field_first = movie->frame->top_field_first; | ||||
| movie->picref->video->key_frame = movie->frame->key_frame; | 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, | movie->file_name, movie->picref->pts, | ||||
| (double)movie->picref->pts * av_q2d(st->time_base), | (double)movie->picref->pts * av_q2d(st->time_base), | ||||
| movie->picref->pos, | 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 | // We got it. Free the packet since we are returning | ||||
| av_free_packet(&pkt); | av_free_packet(&pkt); | ||||