[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)
This commit is contained in:
ejurgensen 2017-01-25 21:02:41 +01:00
parent 084de7811e
commit db4068f046
1 changed files with 5 additions and 1 deletions

View File

@ -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_id = dst_fmt->video_codec;
dst->codec_type = AVMEDIA_TYPE_VIDEO; dst->codec_type = AVMEDIA_TYPE_VIDEO;
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); 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) if (dst->pix_fmt < 0)
{ {
DPRINTF(E_LOG, L_ART, "Could not determine best pixel format\n"); DPRINTF(E_LOG, L_ART, "Could not determine best pixel format\n");