From b7f1010c8fce09096057528f7cd29589ea1ae7df Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 6 Oct 2012 13:29:37 +0200 Subject: tools: do not use av_pix_fmt_descriptors directly. --- cmdutils.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'cmdutils.c') diff --git a/cmdutils.c b/cmdutils.c index ac971df20a..34c52ca136 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -866,7 +866,7 @@ int show_filters(void *optctx, const char *opt, const char *arg) int show_pix_fmts(void *optctx, const char *opt, const char *arg) { - enum AVPixelFormat pix_fmt; + const AVPixFmtDescriptor *pix_desc = NULL; printf("Pixel formats:\n" "I.... = Supported Input format for conversion\n" @@ -882,8 +882,8 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg) # define sws_isSupportedOutput(x) 0 #endif - for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) { - const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt]; + while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) { + enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc); printf("%c%c%c%c%c %-16s %d %2d\n", sws_isSupportedInput (pix_fmt) ? 'I' : '.', sws_isSupportedOutput(pix_fmt) ? 'O' : '.', @@ -1282,13 +1282,19 @@ void *grow_array(void *array, int elem_size, int *size, int new_size) static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbuf) { - FrameBuffer *buf = av_mallocz(sizeof(*buf)); + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt); + FrameBuffer *buf; int i, ret; - const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1; + int pixel_size; int h_chroma_shift, v_chroma_shift; int edge = 32; // XXX should be avcodec_get_edge_width(), but that fails on svq1 int w = s->width, h = s->height; + if (!desc) + return AVERROR(EINVAL); + pixel_size = desc->comp[0].step_minus1 + 1; + + buf = av_mallocz(sizeof(*buf)); if (!buf) return AVERROR(ENOMEM); -- cgit v1.2.3