Replace usage of the deprecated av_pix_fmt_descriptors array with av_pix_fmt_desc_get
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		
				
					committed by
					
						
						Michael Niedermayer
					
				
			
			
				
	
			
			
			
						parent
						
							2c5b92fe90
						
					
				
				
					commit
					79393a8363
				
			@@ -37,7 +37,7 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFo
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (codec && codec->pix_fmts) {
 | 
					    if (codec && codec->pix_fmts) {
 | 
				
			||||||
        const enum AVPixelFormat *p = codec->pix_fmts;
 | 
					        const enum AVPixelFormat *p = codec->pix_fmts;
 | 
				
			||||||
        int has_alpha= av_pix_fmt_descriptors[target].nb_components % 2 == 0;
 | 
					        int has_alpha= av_pix_fmt_desc_get(target)->nb_components % 2 == 0;
 | 
				
			||||||
        enum AVPixelFormat best= AV_PIX_FMT_NONE;
 | 
					        enum AVPixelFormat best= AV_PIX_FMT_NONE;
 | 
				
			||||||
        if (st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
 | 
					        if (st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
 | 
				
			||||||
            if (st->codec->codec_id == AV_CODEC_ID_MJPEG) {
 | 
					            if (st->codec->codec_id == AV_CODEC_ID_MJPEG) {
 | 
				
			||||||
@@ -56,9 +56,9 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFo
 | 
				
			|||||||
            if (target != AV_PIX_FMT_NONE)
 | 
					            if (target != AV_PIX_FMT_NONE)
 | 
				
			||||||
                av_log(NULL, AV_LOG_WARNING,
 | 
					                av_log(NULL, AV_LOG_WARNING,
 | 
				
			||||||
                       "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
 | 
					                       "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
 | 
				
			||||||
                       av_pix_fmt_descriptors[target].name,
 | 
					                       av_get_pix_fmt_name(target),
 | 
				
			||||||
                       codec->name,
 | 
					                       codec->name,
 | 
				
			||||||
                       av_pix_fmt_descriptors[best].name);
 | 
					                       av_get_pix_fmt_name(best));
 | 
				
			||||||
            return best;
 | 
					            return best;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -153,7 +153,7 @@ void* decode_thread(void *arg)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    AVCodecContext *avctx = (AVCodecContext*)arg;
 | 
					    AVCodecContext *avctx = (AVCodecContext*)arg;
 | 
				
			||||||
    StagefrightContext *s = (StagefrightContext*)avctx->priv_data;
 | 
					    StagefrightContext *s = (StagefrightContext*)avctx->priv_data;
 | 
				
			||||||
    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[avctx->pix_fmt];
 | 
					    const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(avctx->pix_fmt);
 | 
				
			||||||
    Frame* frame;
 | 
					    Frame* frame;
 | 
				
			||||||
    MediaBuffer *buffer;
 | 
					    MediaBuffer *buffer;
 | 
				
			||||||
    int32_t w, h;
 | 
					    int32_t w, h;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -424,7 +424,7 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (link->type == AVMEDIA_TYPE_VIDEO) {
 | 
					    if (link->type == AVMEDIA_TYPE_VIDEO) {
 | 
				
			||||||
        if(ref && ref->type == AVMEDIA_TYPE_VIDEO){
 | 
					        if(ref && ref->type == AVMEDIA_TYPE_VIDEO){
 | 
				
			||||||
            int has_alpha= av_pix_fmt_descriptors[ref->format].nb_components % 2 == 0;
 | 
					            int has_alpha= av_pix_fmt_desc_get(ref->format)->nb_components % 2 == 0;
 | 
				
			||||||
            enum AVPixelFormat best= AV_PIX_FMT_NONE;
 | 
					            enum AVPixelFormat best= AV_PIX_FMT_NONE;
 | 
				
			||||||
            int i;
 | 
					            int i;
 | 
				
			||||||
            for (i=0; i<link->in_formats->format_count; i++) {
 | 
					            for (i=0; i<link->in_formats->format_count; i++) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -308,7 +308,7 @@ static int config_input(AVFilterLink *inlink)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    AVFilterContext *ctx = inlink->dst;
 | 
					    AVFilterContext *ctx = inlink->dst;
 | 
				
			||||||
    ColorMatrixContext *color = ctx->priv;
 | 
					    ColorMatrixContext *color = ctx->priv;
 | 
				
			||||||
    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
 | 
					    const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    color->hsub = pix_desc->log2_chroma_w;
 | 
					    color->hsub = pix_desc->log2_chroma_w;
 | 
				
			||||||
    color->vsub = pix_desc->log2_chroma_h;
 | 
					    color->vsub = pix_desc->log2_chroma_h;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -180,7 +180,7 @@ static int config_input(AVFilterLink *inlink)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    AVFilterContext *ctx = inlink->dst;
 | 
					    AVFilterContext *ctx = inlink->dst;
 | 
				
			||||||
    DecimateContext *decimate = ctx->priv;
 | 
					    DecimateContext *decimate = ctx->priv;
 | 
				
			||||||
    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
 | 
					    const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
 | 
				
			||||||
    decimate->hsub = pix_desc->log2_chroma_w;
 | 
					    decimate->hsub = pix_desc->log2_chroma_w;
 | 
				
			||||||
    decimate->vsub = pix_desc->log2_chroma_h;
 | 
					    decimate->vsub = pix_desc->log2_chroma_h;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,8 +59,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "transform.h"
 | 
					#include "transform.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define CHROMA_WIDTH(link)  -((-link->w) >> av_pix_fmt_descriptors[link->format].log2_chroma_w)
 | 
					#define CHROMA_WIDTH(link)  -((-link->w) >> av_pix_fmt_desc_get(link->format)->log2_chroma_w)
 | 
				
			||||||
#define CHROMA_HEIGHT(link) -((-link->h) >> av_pix_fmt_descriptors[link->format].log2_chroma_h)
 | 
					#define CHROMA_HEIGHT(link) -((-link->h) >> av_pix_fmt_desc_get(link->format)->log2_chroma_h)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum SearchMethod {
 | 
					enum SearchMethod {
 | 
				
			||||||
    EXHAUSTIVE,        ///< Search all possible positions
 | 
					    EXHAUSTIVE,        ///< Search all possible positions
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -95,7 +95,7 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
 | 
				
			|||||||
    avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
 | 
					    avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* copy palette if required */
 | 
					    /* copy palette if required */
 | 
				
			||||||
    if (av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PAL)
 | 
					    if (av_pix_fmt_desc_get(inlink->format)->flags & PIX_FMT_PAL)
 | 
				
			||||||
        memcpy(inlink->dst->outputs[0]->out_buf->data[1], picref->data[1], AVPALETTE_SIZE);
 | 
					        memcpy(inlink->dst->outputs[0]->out_buf->data[1], picref->data[1], AVPALETTE_SIZE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
 | 
					    return ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -252,7 +252,7 @@ static int query_formats(AVFilterContext *ctx)
 | 
				
			|||||||
static int config_props(AVFilterLink *inlink)
 | 
					static int config_props(AVFilterLink *inlink)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    HueContext *hue = inlink->dst->priv;
 | 
					    HueContext *hue = inlink->dst->priv;
 | 
				
			||||||
    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[inlink->format];
 | 
					    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    hue->hsub = desc->log2_chroma_w;
 | 
					    hue->hsub = desc->log2_chroma_w;
 | 
				
			||||||
    hue->vsub = desc->log2_chroma_h;
 | 
					    hue->vsub = desc->log2_chroma_h;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -195,7 +195,7 @@ static int end_frame(AVFilterLink *link)
 | 
				
			|||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!idet->csp)
 | 
					    if (!idet->csp)
 | 
				
			||||||
        idet->csp = &av_pix_fmt_descriptors[link->format];
 | 
					        idet->csp = av_pix_fmt_desc_get(link->format);
 | 
				
			||||||
    if (idet->csp->comp[0].depth_minus1 / 8 == 1)
 | 
					    if (idet->csp->comp[0].depth_minus1 / 8 == 1)
 | 
				
			||||||
        idet->filter_line = (void*)filter_line_c_16bit;
 | 
					        idet->filter_line = (void*)filter_line_c_16bit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -217,7 +217,7 @@ static int config_input_overlay(AVFilterLink *inlink)
 | 
				
			|||||||
    char *expr;
 | 
					    char *expr;
 | 
				
			||||||
    double var_values[VAR_VARS_NB], res;
 | 
					    double var_values[VAR_VARS_NB], res;
 | 
				
			||||||
    int ret;
 | 
					    int ret;
 | 
				
			||||||
    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
 | 
					    const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    av_image_fill_max_pixsteps(over->overlay_pix_step, NULL, pix_desc);
 | 
					    av_image_fill_max_pixsteps(over->overlay_pix_step, NULL, pix_desc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -169,7 +169,7 @@ static int alloc_sws_context(FilterParam *f, int width, int height, unsigned int
 | 
				
			|||||||
static int config_props(AVFilterLink *inlink)
 | 
					static int config_props(AVFilterLink *inlink)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    SmartblurContext *sblur = inlink->dst->priv;
 | 
					    SmartblurContext *sblur = inlink->dst->priv;
 | 
				
			||||||
    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[inlink->format];
 | 
					    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sblur->hsub = desc->log2_chroma_w;
 | 
					    sblur->hsub = desc->log2_chroma_w;
 | 
				
			||||||
    sblur->vsub = desc->log2_chroma_h;
 | 
					    sblur->vsub = desc->log2_chroma_h;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,7 +130,7 @@ static int config_out_props(AVFilterLink *outlink)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    AVFilterContext *ctx = outlink->src;
 | 
					    AVFilterContext *ctx = outlink->src;
 | 
				
			||||||
    AVFilterLink *inlink = outlink->src->inputs[0];
 | 
					    AVFilterLink *inlink = outlink->src->inputs[0];
 | 
				
			||||||
    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[outlink->format];
 | 
					    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format);
 | 
				
			||||||
    TInterlaceContext *tinterlace = ctx->priv;
 | 
					    TInterlaceContext *tinterlace = ctx->priv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tinterlace->vsub = desc->log2_chroma_h;
 | 
					    tinterlace->vsub = desc->log2_chroma_h;
 | 
				
			||||||
@@ -179,7 +179,7 @@ void copy_picture_field(uint8_t *dst[4], int dst_linesize[4],
 | 
				
			|||||||
                        enum AVPixelFormat format, int w, int src_h,
 | 
					                        enum AVPixelFormat format, int w, int src_h,
 | 
				
			||||||
                        int src_field, int interleave, int dst_field)
 | 
					                        int src_field, int interleave, int dst_field)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[format];
 | 
					    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
 | 
				
			||||||
    int plane, vsub = desc->log2_chroma_h;
 | 
					    int plane, vsub = desc->log2_chroma_h;
 | 
				
			||||||
    int k = src_field == FIELD_UPPER_AND_LOWER ? 1 : 2;
 | 
					    int k = src_field == FIELD_UPPER_AND_LOWER ? 1 : 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -286,7 +286,7 @@ int ff_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
 | 
				
			|||||||
        avfilter_copy_buffer_ref_props(link->cur_buf, link->src_buf);
 | 
					        avfilter_copy_buffer_ref_props(link->cur_buf, link->src_buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* copy palette if required */
 | 
					        /* copy palette if required */
 | 
				
			||||||
        if (av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL)
 | 
					        if (av_pix_fmt_desc_get(link->format)->flags & PIX_FMT_PAL)
 | 
				
			||||||
            memcpy(link->cur_buf->data[1], link->src_buf-> data[1], AVPALETTE_SIZE);
 | 
					            memcpy(link->cur_buf->data[1], link->src_buf-> data[1], AVPALETTE_SIZE);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -298,7 +298,7 @@ static int config_props(AVFilterLink *outlink)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    AVFilterContext *ctx = outlink->src;
 | 
					    AVFilterContext *ctx = outlink->src;
 | 
				
			||||||
    MPTestContext *test = ctx->priv;
 | 
					    MPTestContext *test = ctx->priv;
 | 
				
			||||||
    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[outlink->format];
 | 
					    const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(outlink->format);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    test->hsub = pix_desc->log2_chroma_w;
 | 
					    test->hsub = pix_desc->log2_chroma_w;
 | 
				
			||||||
    test->vsub = pix_desc->log2_chroma_h;
 | 
					    test->vsub = pix_desc->log2_chroma_h;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -602,8 +602,8 @@ static av_always_inline int isRGB(enum AVPixelFormat pix_fmt)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#if 0 // FIXME
 | 
					#if 0 // FIXME
 | 
				
			||||||
#define isGray(x) \
 | 
					#define isGray(x) \
 | 
				
			||||||
    (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) && \
 | 
					    (!(av_pix_fmt_desc_get(x)->flags & PIX_FMT_PAL) && \
 | 
				
			||||||
     av_pix_fmt_descriptors[x].nb_components <= 2)
 | 
					     av_pix_fmt_desc_get(x)->nb_components <= 2)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define isGray(x)                      \
 | 
					#define isGray(x)                      \
 | 
				
			||||||
    ((x) == AV_PIX_FMT_GRAY8       ||  \
 | 
					    ((x) == AV_PIX_FMT_GRAY8       ||  \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -402,7 +402,7 @@ av_cold void ff_sws_init_swScale_mmx(SwsContext *c)
 | 
				
			|||||||
    } else if (c->srcBpc == 12) { \
 | 
					    } else if (c->srcBpc == 12) { \
 | 
				
			||||||
        hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \
 | 
					        hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \
 | 
				
			||||||
                                     ff_hscale12to19_ ## filtersize ## _ ## opt1; \
 | 
					                                     ff_hscale12to19_ ## filtersize ## _ ## opt1; \
 | 
				
			||||||
    } else if (c->srcBpc == 14 || ((c->srcFormat==AV_PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1<15)) { \
 | 
					    } else if (c->srcBpc == 14 || ((c->srcFormat==AV_PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_desc_get(c->srcFormat)->comp[0].depth_minus1<15)) { \
 | 
				
			||||||
        hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \
 | 
					        hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \
 | 
				
			||||||
                                     ff_hscale14to19_ ## filtersize ## _ ## opt1; \
 | 
					                                     ff_hscale14to19_ ## filtersize ## _ ## opt1; \
 | 
				
			||||||
    } else { /* c->srcBpc == 16 */ \
 | 
					    } else { /* c->srcBpc == 16 */ \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -98,7 +98,7 @@ int main(int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (list_pix_fmt_fourccs) {
 | 
					    if (list_pix_fmt_fourccs) {
 | 
				
			||||||
        for (i = 0; i < AV_PIX_FMT_NB; i++) {
 | 
					        for (i = 0; i < AV_PIX_FMT_NB; i++) {
 | 
				
			||||||
            const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[i];
 | 
					            const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(i);
 | 
				
			||||||
            if (!pix_desc->name || pix_desc->flags & PIX_FMT_HWACCEL)
 | 
					            if (!pix_desc->name || pix_desc->flags & PIX_FMT_HWACCEL)
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
            printf("%s: ", pix_desc->name);
 | 
					            printf("%s: ", pix_desc->name);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user