Unified · Split
| @@ -504,6 +504,16 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 503 unmodified lines | |||
| 504 | ret = libx265_encode_set_roi(ctx, pic, &x265pic); | 504 | ret = libx265_encode_set_roi(ctx, pic, &x265pic); |
| 505 | if (ret < 0) | 505 | if (ret < 0) |
| 506 | return ret; | 506 | return ret; |
| 507 | |||
| 508 | if (pic->reordered_opaque) { | ||
| 509 | x265pic.userData = av_malloc(sizeof(pic->reordered_opaque)); | ||
| 510 | if (!x265pic.userData) { | ||
| 511 | av_freep(&x265pic.quantOffsets); | ||
| 512 | return AVERROR(ENOMEM); | ||
| 513 | } | ||
| 514 | |||
| 515 | memcpy(x265pic.userData, &pic->reordered_opaque, sizeof(pic->reordered_opaque)); | ||
| 516 | } | ||
| 507 | } | 517 | } |
| 508 | 518 | ||
| 509 | ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal, | 519 | ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal, |
| @@ -570,6 +580,12 @@ FF_ENABLE_DEPRECATION_WARNINGS · 60 unmodified lines | |||
| 570 | 580 | ||
| 571 | ff_side_data_set_encoder_stats(pkt, x265pic_out.frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type); | 581 | ff_side_data_set_encoder_stats(pkt, x265pic_out.frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type); |
| 572 | 582 | ||
| 583 | if (x265pic_out.userData) { | ||
| 584 | memcpy(&avctx->reordered_opaque, x265pic_out.userData, sizeof(avctx->reordered_opaque)); | ||
| 585 | av_freep(&x265pic_out.userData); | ||
| 586 | } else | ||
| 587 | avctx->reordered_opaque = 0; | ||
| 588 | |||
| 573 | *got_packet = 1; | 589 | *got_packet = 1; |
| 574 | return 0; | 590 | return 0; |
| 575 | } | 591 | } |
| @@ -683,6 +699,7 @@ AVCodec ff_libx265_encoder = { · 107 unmodified lines | |||
| 683 | .priv_data_size = sizeof(libx265Context), | 699 | .priv_data_size = sizeof(libx265Context), |
| 684 | .priv_class = &class, | 700 | .priv_class = &class, |
| 685 | .defaults = x265_defaults, | 701 | .defaults = x265_defaults, |
| 686 | .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS, | 702 | .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS | |
| 703 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, | ||
| 687 | .wrapper_name = "libx265", | 704 | .wrapper_name = "libx265", |
| 688 | }; | 705 | }; |