Browse Source

lavfi: do not use av_pix_fmt_descriptors directly.

Anton Khirnov 12 years ago
parent
commit
59ee9f78b0

+ 1 - 1
libavfilter/avfilter.c

@@ -214,7 +214,7 @@ void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
         av_dlog(ctx,
                 "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
                 link, link->w, link->h,
-                av_pix_fmt_descriptors[link->format].name,
+                av_get_pix_fmt_name(link->format),
                 link->src ? link->src->filter->name : "",
                 link->dst ? link->dst->filter->name : "",
                 end ? "\n" : "");

+ 1 - 1
libavfilter/buffersrc.c

@@ -185,7 +185,7 @@ static av_cold int init_video(AVFilterContext *ctx, const char *args)
     if (!(c->fifo = av_fifo_alloc(sizeof(AVFilterBufferRef*))))
         return AVERROR(ENOMEM);
 
-    av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d pixfmt:%s\n", c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name);
+    av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d pixfmt:%s\n", c->w, c->h, av_get_pix_fmt_name(c->pix_fmt));
     return 0;
 }
 

+ 1 - 1
libavfilter/drawutils.c

@@ -32,7 +32,7 @@ int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t
 {
     uint8_t rgba_map[4] = {0};
     int i;
-    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
+    const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(pix_fmt);
     int hsub = pix_desc->log2_chroma_w;
 
     *is_packed_rgba = 1;

+ 2 - 2
libavfilter/filtfmts.c

@@ -89,7 +89,7 @@ int main(int argc, char **argv)
         for (j = 0; j < fmts->format_count; j++)
             printf("INPUT[%d] %s: %s\n",
                    i, filter_ctx->filter->inputs[i].name,
-                   av_pix_fmt_descriptors[fmts->formats[j]].name);
+                   av_get_pix_fmt_name(fmts->formats[j]));
     }
 
     /* print the supported formats in output */
@@ -98,7 +98,7 @@ int main(int argc, char **argv)
         for (j = 0; j < fmts->format_count; j++)
             printf("OUTPUT[%d] %s: %s\n",
                    i, filter_ctx->filter->outputs[i].name,
-                   av_pix_fmt_descriptors[fmts->formats[j]].name);
+                   av_get_pix_fmt_name(fmts->formats[j]));
     }
 
     avfilter_free(filter_ctx);

+ 4 - 2
libavfilter/formats.c

@@ -213,10 +213,12 @@ AVFilterFormats *ff_all_formats(enum AVMediaType type)
     int num_formats = type == AVMEDIA_TYPE_VIDEO ? AV_PIX_FMT_NB    :
                       type == AVMEDIA_TYPE_AUDIO ? AV_SAMPLE_FMT_NB : 0;
 
-    for (fmt = 0; fmt < num_formats; fmt++)
+    for (fmt = 0; fmt < num_formats; fmt++) {
+        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
         if ((type != AVMEDIA_TYPE_VIDEO) ||
-            (type == AVMEDIA_TYPE_VIDEO && !(av_pix_fmt_descriptors[fmt].flags & PIX_FMT_HWACCEL)))
+            (type == AVMEDIA_TYPE_VIDEO && !(desc->flags & PIX_FMT_HWACCEL)))
             ff_add_format(&ret, fmt);
+    }
 
     return ret;
 }

+ 1 - 1
libavfilter/vf_boxblur.c

@@ -139,7 +139,7 @@ static int query_formats(AVFilterContext *ctx)
 
 static int config_input(AVFilterLink *inlink)
 {
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[inlink->format];
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
     AVFilterContext    *ctx = inlink->dst;
     BoxBlurContext *boxblur = ctx->priv;
     int w = inlink->w, h = inlink->h;

+ 5 - 5
libavfilter/vf_crop.c

@@ -158,7 +158,7 @@ static int config_input(AVFilterLink *link)
 {
     AVFilterContext *ctx = link->dst;
     CropContext *crop = ctx->priv;
-    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[link->format];
+    const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(link->format);
     int ret;
     const char *expr;
     double res;
@@ -177,8 +177,8 @@ static int config_input(AVFilterLink *link)
     crop->var_values[VAR_POS]   = NAN;
 
     av_image_fill_max_pixsteps(crop->max_step, NULL, pix_desc);
-    crop->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
-    crop->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
+    crop->hsub = pix_desc->log2_chroma_w;
+    crop->vsub = pix_desc->log2_chroma_h;
 
     if ((ret = av_expr_parse_and_eval(&res, (expr = crop->ow_expr),
                                       var_names, crop->var_values,
@@ -248,6 +248,7 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
     AVFilterContext *ctx = link->dst;
     CropContext *crop = ctx->priv;
     AVFilterBufferRef *ref2;
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
     int i;
 
     ref2 = avfilter_ref_buffer(picref, ~0);
@@ -281,8 +282,7 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
     ref2->data[0] += crop->y * ref2->linesize[0];
     ref2->data[0] += crop->x * crop->max_step[0];
 
-    if (!(av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL ||
-          av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PSEUDOPAL)) {
+    if (!(desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL)) {
         for (i = 1; i < 3; i ++) {
             if (ref2->data[i]) {
                 ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i];

+ 1 - 1
libavfilter/vf_cropdetect.c

@@ -107,7 +107,7 @@ static int config_input(AVFilterLink *inlink)
     CropDetectContext *cd = ctx->priv;
 
     av_image_fill_max_pixsteps(cd->max_pixsteps, NULL,
-                               &av_pix_fmt_descriptors[inlink->format]);
+                               av_pix_fmt_desc_get(inlink->format));
 
     cd->x1 = inlink->w - 1;
     cd->y1 = inlink->h - 1;

+ 3 - 2
libavfilter/vf_delogo.c

@@ -226,9 +226,10 @@ static int end_frame(AVFilterLink *inlink)
     AVFilterLink *outlink = inlink->dst->outputs[0];
     AVFilterBufferRef *inpicref  = inlink ->cur_buf;
     AVFilterBufferRef *outpicref = outlink->out_buf;
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
     int direct = inpicref->buf == outpicref->buf;
-    int hsub0 = av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
-    int vsub0 = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
+    int hsub0 = desc->log2_chroma_w;
+    int vsub0 = desc->log2_chroma_h;
     int plane;
     int ret;
 

+ 3 - 2
libavfilter/vf_drawbox.c

@@ -81,9 +81,10 @@ static int query_formats(AVFilterContext *ctx)
 static int config_input(AVFilterLink *inlink)
 {
     DrawBoxContext *drawbox = inlink->dst->priv;
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
 
-    drawbox->hsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
-    drawbox->vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
+    drawbox->hsub = desc->log2_chroma_w;
+    drawbox->vsub = desc->log2_chroma_h;
 
     if (drawbox->w == 0) drawbox->w = inlink->w;
     if (drawbox->h == 0) drawbox->h = inlink->h;

Some files were not shown because too many files changed in this diff