audio wave icons, viewer wave image, 7 lib updates, tweak file size
[goodguy/history.git] / cinelerra-5.1 / thirdparty / src / ffmpeg-3.4.1.patch5
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
3 @@ -45,6 +45,7 @@
4      int   forced_idr;
5      char *preset;
6      char *tune;
7 +    char *profile;
8      char *x265_opts;
9  } libx265Context;
10  
11 @@ -114,11 +115,11 @@
12      ctx->params->sourceHeight    = avctx->height;
13      ctx->params->bEnablePsnr     = !!(avctx->flags & AV_CODEC_FLAG_PSNR);
14  
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)) {
24  
25          ctx->params->vui.bEnableVideoSignalTypePresentFlag  = 1;
26 @@ -220,6 +221,18 @@
27          }
28      }
29  
30 +    if (ctx->profile) {
31 +        if (ctx->api->param_apply_profile(ctx->params, ctx->profile) < 0) {
32 +            int i;
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);
39 +        }
40 +    }
41 +
42      ctx->encoder = ctx->api->encoder_open(ctx->params);
43      if (!ctx->encoder) {
44          av_log(avctx, AV_LOG_ERROR, "Cannot open libx265 encoder.\n");
45 @@ -294,7 +307,7 @@
46      for (i = 0; i < nnal; i++)
47          payload += nal[i].sizeBytes;
48  
49 -    ret = ff_alloc_packet(pkt, payload);
50 +    ret = ff_alloc_packet2(avctx, pkt, payload, payload);
51      if (ret < 0) {
52          av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
53          return ret;
54 @@ -392,6 +412,7 @@
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 },
60      { NULL }
61  };