[swscaler @ ...] deprecated pixel format used, make sure you did set range correctly

 

我自己在使用如下函数进行转换时报的错

int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[],
              const int srcStride[], int srcSliceY, int srcSliceH,
              uint8_t *const dst[], const int dstStride[]);

 

网上搜索的答案:

https://stackoverflow.com/questions/23067722/swscaler-warning-deprecated-pixel-format-used

 

原因就是你使用的格式已经被废除了,在如下链接可以看到哪些不能用了:

https://libav.org/documentation/doxygen/master/pixfmt_8h.html#a9a8e335cf3be472042bc9f0cf80cd4c5。

 

我写的转换函数:

AVPixelFormat ConvertDeprecatedFormat(enum AVPixelFormat format)
{
    switch (format)
    {
    case AV_PIX_FMT_YUVJ420P:
        return AV_PIX_FMT_YUV420P;
        break;
    case AV_PIX_FMT_YUVJ422P:
        return AV_PIX_FMT_YUV422P;
        break;
    case AV_PIX_FMT_YUVJ444P:
        return AV_PIX_FMT_YUV444P;
        break;
    case AV_PIX_FMT_YUVJ440P:
        return AV_PIX_FMT_YUV440P;
        break;
    default:
        return format;
        break;
    }
}

 

要使用新的格式类型,并且设置color range,还没有弄清color range的概念,后续再补充,先记下来。

 

转载于:https://www.cnblogs.com/zoneofmine/p/10839355.html

你可能感兴趣的:([swscaler @ ...] deprecated pixel format used, make sure you did set range correctly)