lavc: sws fallback - use UYVY if none pixfmt avail

Use UYVY as a fallback intermediate if no eligible pixfmt is reported.
This could eg. happen if no conversion fullfill constraint (eg.
currently R10k to anything WRT subsampling 4:2:0).
This commit is contained in:
Martin Pulec
2022-07-22 14:56:33 +02:00
parent d7483d26de
commit 34f93a6795

View File

@@ -1236,7 +1236,7 @@ static bool configure_with(struct state_video_compress_libav *s, struct video_de
//get all AVPixelFormats we can convert to and pick the first
auto fmts = get_available_pix_fmts(desc, codec, s->requested_subsampling, VIDEO_CODEC_NONE);
s->sws_out_pixfmt = s->selected_pixfmt;
s->selected_pixfmt = fmts.front();
s->selected_pixfmt = fmts.empty() ? AV_PIX_FMT_UYVY422 : fmts.front();
log_msg(LOG_LEVEL_NOTICE, MOD_NAME "Attempting to use swscale to convert from %s to %s.\n", av_get_pix_fmt_name(s->selected_pixfmt), av_get_pix_fmt_name(s->sws_out_pixfmt));
if(!find_decoder(desc, s->selected_pixfmt, &s->decoded_codec, &s->decoder)){
//Should not happen as get_available_pix_fmts should only