Commit 50fc1484 authored by Tristan Matthews's avatar Tristan Matthews

* #30480: video: backport av_pix_fmt_desc_get

parent 6fb863b1
......@@ -75,6 +75,14 @@ extern "C" {
#if !LIBAVUTIL_VERSION_CHECK(51, 42, 0, 74, 100) && !defined(FF_API_PIX_FMT)
#define AVPixelFormat PixelFormat
#define PIXEL_FORMAT(FMT) PIX_FMT_ ## FMT
static inline const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
{
if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
return NULL;
return &av_pix_fmt_descriptors[pix_fmt];
}
#else
#define PIXEL_FORMAT(FMT) AV_PIX_FMT_ ## FMT
#endif
......
......@@ -220,6 +220,10 @@ static int flipHorizontal(AVFrame *frame)
uint8_t *inrow, *outrow;
int step, hsub, vsub;
const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get((AVPixelFormat) libav_utils::libav_pixel_format(frame->format));
if (!pix_desc) {
ERROR("Could not get pixel descriptor");
return -1;
}
int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes
av_image_fill_max_pixsteps(max_step, NULL, pix_desc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment