1 --- a/libavcodec/libx265.c 2017-12-10 14:35:08.000000000 -0700
2 +++ b/libavcodec/libx265.c 2018-02-08 16:57:46.028108824 -0700
12 ctx->params->sourceHeight = avctx->height;
13 ctx->params->bEnablePsnr = !!(avctx->flags & AV_CODEC_FLAG_PSNR);
15 - if ((avctx->color_primaries <= AVCOL_PRI_BT2020 &&
16 + if ((avctx->color_primaries <= AVCOL_PRI_SMPTE432 &&
17 avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) ||
18 - (avctx->color_trc <= AVCOL_TRC_BT2020_12 &&
19 + (avctx->color_trc <= AVCOL_TRC_ARIB_STD_B67 &&
20 avctx->color_trc != AVCOL_TRC_UNSPECIFIED) ||
21 - (avctx->colorspace <= AVCOL_SPC_BT2020_CL &&
22 + (avctx->colorspace <= AVCOL_SPC_ICTCP &&
23 avctx->colorspace != AVCOL_SPC_UNSPECIFIED)) {
25 ctx->params->vui.bEnableVideoSignalTypePresentFlag = 1;
31 + if (ctx->api->param_apply_profile(ctx->params, ctx->profile) < 0) {
33 + av_log(avctx, AV_LOG_ERROR, "Invalid or incompatible profile set: %s.\n", ctx->profile);
34 + av_log(avctx, AV_LOG_INFO, "Possible profiles:");
35 + for (i = 0; x265_profile_names[i]; i++)
36 + av_log(avctx, AV_LOG_INFO, " %s", x265_profile_names[i]);
37 + av_log(avctx, AV_LOG_INFO, "\n");
38 + return AVERROR(EINVAL);
42 ctx->encoder = ctx->api->encoder_open(ctx->params);
44 av_log(avctx, AV_LOG_ERROR, "Cannot open libx265 encoder.\n");
46 for (i = 0; i < nnal; i++)
47 payload += nal[i].sizeBytes;
49 - ret = ff_alloc_packet(pkt, payload);
50 + ret = ff_alloc_packet2(avctx, pkt, payload, payload);
52 av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
55 { "forced-idr", "if forcing keyframes, force them as IDR frames", OFFSET(forced_idr),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
56 { "preset", "set the x265 preset", OFFSET(preset), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
57 { "tune", "set the x265 tune parameter", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
58 + { "profile", "set the x265 profile", OFFSET(profile), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
59 { "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },