14 const AVPicture *src,
int src_pix_fmt,
15 int src_width,
int src_height) {
16 static struct SwsContext *img_convert_ctx =
nullptr;
17 if (img_convert_ctx==
nullptr) {
19 img_convert_ctx = sws_getContext(src_width, src_height,
20 (AVPixelFormat)src_pix_fmt,
21 src_width, src_height,
22 (AVPixelFormat)dst_pix_fmt,
24 nullptr,
nullptr,
nullptr);
28 if (img_convert_ctx!=
nullptr) {
39 sws_scale(img_convert_ctx, ((AVPicture*)src)->data,
40 ((AVPicture*)src)->linesize, 0, src_height,
41 ((AVPicture*)dst)->data, ((AVPicture*)dst)->linesize);
44 fprintf(stderr,
"image conversion failed\n");