From db4068f0464825b825dab19dff7b6406a1740363 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Wed, 25 Jan 2017 21:02:41 +0100 Subject: [PATCH] [artwork] Hardcode destination pixel format for png rescaling since avcode_find_best_pix_fmt_of_list() does not live up to its name (fixes issue #345) --- src/artwork.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/artwork.c b/src/artwork.c index 423bdebc..a17a6519 100644 --- a/src/artwork.c +++ b/src/artwork.c @@ -457,7 +457,11 @@ artwork_rescale(struct evbuffer *evbuf, AVFormatContext *src_ctx, int s, int out dst->codec_id = dst_fmt->video_codec; dst->codec_type = AVMEDIA_TYPE_VIDEO; - dst->pix_fmt = avcodec_find_best_pix_fmt_of_list((enum AVPixelFormat *)img_encoder->pix_fmts, src->pix_fmt, 1, NULL); + if (dst_fmt->video_codec == AV_CODEC_ID_PNG) + dst->pix_fmt = AV_PIX_FMT_RGB24; + else + dst->pix_fmt = avcodec_find_best_pix_fmt_of_list((enum AVPixelFormat *)img_encoder->pix_fmts, src->pix_fmt, 1, NULL); + if (dst->pix_fmt < 0) { DPRINTF(E_LOG, L_ART, "Could not determine best pixel format\n");