static int get_target_format(struct image_writer_ctx *ctx) { struct AVCodec *codec = avcodec_find_encoder(ctx->opts->format); if (!codec) goto unknown; int srcfmt = ctx->original_format.id; int target = get_encoder_format(codec, srcfmt, ctx->opts->high_bit_depth); if (!target) target = get_encoder_format(codec, srcfmt, true); if (!target) goto unknown; return target; unknown: return IMGFMT_RGB0; }
static int get_target_format(struct image_writer_ctx *ctx, int srcfmt) { if (!ctx->writer->lavc_codec) goto unknown; struct AVCodec *codec = avcodec_find_encoder(ctx->writer->lavc_codec); if (!codec) goto unknown; int target = get_encoder_format(codec, srcfmt, ctx->opts->high_bit_depth); if (!target) target = get_encoder_format(codec, srcfmt, true); if (!target) goto unknown; return target; unknown: return IMGFMT_RGB24; }