Browse code

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.

Stefano Sabatini authored on 2011/04/29 20:12:39
Showing 14 changed files
... ...
@@ -912,7 +912,7 @@ int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
912 912
     frame->top_field_first  = picref->video->top_field_first;
913 913
     frame->key_frame        = picref->video->key_frame;
914 914
     frame->pict_type        = picref->video->pict_type;
915
-    frame->sample_aspect_ratio = picref->video->pixel_aspect;
915
+    frame->sample_aspect_ratio = picref->video->sample_aspect_ratio;
916 916
 
917 917
     return 1;
918 918
 }
... ...
@@ -13,6 +13,10 @@ libavutil:   2011-04-18
13 13
 
14 14
 API changes, most recent first:
15 15
 
16
+2011-05-01 - xxxxxxx - lavfi 2.4.0 - avfilter.h
17
+  Rename AVFilterBufferRefVideoProps.pixel_aspect to
18
+  sample_aspect_ratio.
19
+
16 20
 2011-05-01 - xxxxxxx - lavc 53.3.0 - AVFrame
17 21
   Add a sample_aspect_ratio field to AVFrame.
18 22
 
... ...
@@ -1696,7 +1696,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
1696 1696
                         case AVMEDIA_TYPE_VIDEO:
1697 1697
 #if CONFIG_AVFILTER
1698 1698
                             if (ost->picref->video && !ost->frame_aspect_ratio)
1699
-                                ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect;
1699
+                                ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio;
1700 1700
 #endif
1701 1701
                             do_video_out(os, ost, ist, &picture, &frame_size);
1702 1702
                             if (vstats_filename && frame_size)
... ...
@@ -692,10 +692,10 @@ static void video_image_display(VideoState *is)
692 692
     vp = &is->pictq[is->pictq_rindex];
693 693
     if (vp->bmp) {
694 694
 #if CONFIG_AVFILTER
695
-         if (vp->picref->video->pixel_aspect.num == 0)
695
+         if (vp->picref->video->sample_aspect_ratio.num == 0)
696 696
              aspect_ratio = 0;
697 697
          else
698
-             aspect_ratio = av_q2d(vp->picref->video->pixel_aspect);
698
+             aspect_ratio = av_q2d(vp->picref->video->sample_aspect_ratio);
699 699
 #else
700 700
 
701 701
         /* XXX: use variable in the frame */
... ...
@@ -1688,7 +1688,7 @@ static int input_request_frame(AVFilterLink *link)
1688 1688
 
1689 1689
     picref->pts = pts;
1690 1690
     picref->pos = priv->frame->pkt_pos;
1691
-    picref->video->pixel_aspect = priv->frame->sample_aspect_ratio;
1691
+    picref->video->sample_aspect_ratio = priv->frame->sample_aspect_ratio;
1692 1692
     avfilter_start_frame(link, picref);
1693 1693
     avfilter_draw_slice(link, 0, link->h, 1);
1694 1694
     avfilter_end_frame(link);
... ...
@@ -238,7 +238,7 @@ static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
238 238
 
239 239
     if (ref->video) {
240 240
         av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
241
-                ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
241
+                ref->video->sample_aspect_ratio.num, ref->video->sample_aspect_ratio.den,
242 242
                 ref->video->w, ref->video->h,
243 243
                 !ref->video->interlaced     ? 'P' :         /* Progressive  */
244 244
                 ref->video->top_field_first ? 'T' : 'B',    /* Top / Bottom */
... ...
@@ -26,7 +26,7 @@
26 26
 #include "libavutil/samplefmt.h"
27 27
 
28 28
 #define LIBAVFILTER_VERSION_MAJOR  2
29
-#define LIBAVFILTER_VERSION_MINOR  1
29
+#define LIBAVFILTER_VERSION_MINOR  4
30 30
 #define LIBAVFILTER_VERSION_MICRO  0
31 31
 
32 32
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
... ...
@@ -112,7 +112,7 @@ typedef struct AVFilterBufferRefAudioProps {
112 112
 typedef struct AVFilterBufferRefVideoProps {
113 113
     int w;                      ///< image width
114 114
     int h;                      ///< image height
115
-    AVRational pixel_aspect;    ///< pixel aspect ratio
115
+    AVRational sample_aspect_ratio; ///< sample aspect ratio
116 116
     int interlaced;             ///< is frame interlaced
117 117
     int top_field_first;        ///< field order
118 118
     enum AVPictureType pict_type; ///< picture type of the frame
... ...
@@ -65,7 +65,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
65 65
 {
66 66
     AspectContext *aspect = link->dst->priv;
67 67
 
68
-    picref->video->pixel_aspect = aspect->aspect;
68
+    picref->video->sample_aspect_ratio = aspect->aspect;
69 69
     avfilter_start_frame(link->dst->outputs[0], picref);
70 70
 }
71 71
 
... ...
@@ -430,7 +430,7 @@ static int source_request_frame(AVFilterLink *outlink)
430 430
 {
431 431
     Frei0rContext *frei0r = outlink->src->priv;
432 432
     AVFilterBufferRef *picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
433
-    picref->video->pixel_aspect = (AVRational) {1, 1};
433
+    picref->video->sample_aspect_ratio = (AVRational) {1, 1};
434 434
     picref->pts = frei0r->pts++;
435 435
     picref->pos = -1;
436 436
 
... ...
@@ -252,9 +252,9 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
252 252
 
253 253
     outlink->out_buf = outpicref;
254 254
 
255
-    av_reduce(&outpicref->video->pixel_aspect.num, &outpicref->video->pixel_aspect.den,
256
-              (int64_t)picref->video->pixel_aspect.num * outlink->h * link->w,
257
-              (int64_t)picref->video->pixel_aspect.den * outlink->w * link->h,
255
+    av_reduce(&outpicref->video->sample_aspect_ratio.num, &outpicref->video->sample_aspect_ratio.den,
256
+              (int64_t)picref->video->sample_aspect_ratio.num * outlink->h * link->w,
257
+              (int64_t)picref->video->sample_aspect_ratio.den * outlink->w * link->h,
258 258
               INT_MAX);
259 259
 
260 260
     scale->slice_y = 0;
... ...
@@ -59,7 +59,7 @@ static void end_frame(AVFilterLink *inlink)
59 59
            showinfo->frame,
60 60
            picref->pts, picref ->pts * av_q2d(inlink->time_base), picref->pos,
61 61
            av_pix_fmt_descriptors[picref->format].name,
62
-           picref->video->pixel_aspect.num, picref->video->pixel_aspect.den,
62
+           picref->video->sample_aspect_ratio.num, picref->video->sample_aspect_ratio.den,
63 63
            picref->video->w, picref->video->h,
64 64
            !picref->video->interlaced     ? 'P' :         /* Progressive  */
65 65
            picref->video->top_field_first ? 'T' : 'B',    /* Top / Bottom */
... ...
@@ -122,11 +122,11 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
122 122
                                                  outlink->w, outlink->h);
123 123
     outlink->out_buf->pts = picref->pts;
124 124
 
125
-    if (picref->video->pixel_aspect.num == 0) {
126
-        outlink->out_buf->video->pixel_aspect = picref->video->pixel_aspect;
125
+    if (picref->video->sample_aspect_ratio.num == 0) {
126
+        outlink->out_buf->video->sample_aspect_ratio = picref->video->sample_aspect_ratio;
127 127
     } else {
128
-        outlink->out_buf->video->pixel_aspect.num = picref->video->pixel_aspect.den;
129
-        outlink->out_buf->video->pixel_aspect.den = picref->video->pixel_aspect.num;
128
+        outlink->out_buf->video->sample_aspect_ratio.num = picref->video->sample_aspect_ratio.den;
129
+        outlink->out_buf->video->sample_aspect_ratio.den = picref->video->sample_aspect_ratio.num;
130 130
     }
131 131
 
132 132
     avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
... ...
@@ -34,7 +34,7 @@ typedef struct {
34 34
     int               h, w;
35 35
     enum PixelFormat  pix_fmt;
36 36
     AVRational        time_base;     ///< time_base to set in the output link
37
-    AVRational        pixel_aspect;
37
+    AVRational        sample_aspect_ratio;
38 38
     char              sws_param[256];
39 39
 } BufferSourceContext;
40 40
 
... ...
@@ -130,7 +130,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
130 130
     if (!args ||
131 131
         (n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str,
132 132
                     &c->time_base.num, &c->time_base.den,
133
-                    &c->pixel_aspect.num, &c->pixel_aspect.den)) != 7) {
133
+                    &c->sample_aspect_ratio.num, &c->sample_aspect_ratio.den)) != 7) {
134 134
         av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but only %d found in '%s'\n", n, args);
135 135
         return AVERROR(EINVAL);
136 136
     }
... ...
@@ -162,7 +162,7 @@ static int config_props(AVFilterLink *link)
162 162
 
163 163
     link->w = c->w;
164 164
     link->h = c->h;
165
-    link->sample_aspect_ratio = c->pixel_aspect;
165
+    link->sample_aspect_ratio = c->sample_aspect_ratio;
166 166
     link->time_base = c->time_base;
167 167
 
168 168
     return 0;
... ...
@@ -190,7 +190,7 @@ static int request_frame(AVFilterLink *link)
190 190
                   picref->format, link->w, link->h);
191 191
 
192 192
     picref->pts                    = c->pts;
193
-    picref->video->pixel_aspect    = c->frame.sample_aspect_ratio;
193
+    picref->video->sample_aspect_ratio = 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;
... ...
@@ -132,7 +132,7 @@ static int color_request_frame(AVFilterLink *link)
132 132
 {
133 133
     ColorContext *color = link->src->priv;
134 134
     AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h);
135
-    picref->video->pixel_aspect = (AVRational) {1, 1};
135
+    picref->video->sample_aspect_ratio = (AVRational) {1, 1};
136 136
     picref->pts                 = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q);
137 137
     picref->pos                 = 0;
138 138
 
... ...
@@ -248,7 +248,7 @@ static int movie_get_frame(AVFilterLink *outlink)
248 248
 
249 249
                 movie->picref->pos                    = movie->frame->pkt_pos;
250 250
                 if (!movie->frame->sample_aspect_ratio.num)
251
-                    movie->picref->video->pixel_aspect = st->sample_aspect_ratio;
251
+                    movie->picref->video->sample_aspect_ratio = st->sample_aspect_ratio;
252 252
                 movie->picref->video->interlaced      = movie->frame->interlaced_frame;
253 253
                 movie->picref->video->top_field_first = movie->frame->top_field_first;
254 254
                 movie->picref->video->key_frame       = movie->frame->key_frame;
... ...
@@ -258,7 +258,8 @@ static int movie_get_frame(AVFilterLink *outlink)
258 258
                         movie->file_name, movie->picref->pts,
259 259
                         (double)movie->picref->pts * av_q2d(st->time_base),
260 260
                         movie->picref->pos,
261
-                        movie->picref->video->pixel_aspect.num, movie->picref->video->pixel_aspect.den);
261
+                        movie->picref->video->sample_aspect_ratio.num,
262
+                        movie->picref->video->sample_aspect_ratio.den);
262 263
                 // We got it. Free the packet since we are returning
263 264
                 av_free_packet(&pkt);
264 265