History

avcodec/libx265: add support for reordered_opaque

James Almer committed 6 years ago

Commit 74dfc881 parent 050b72a1 file · +18 −1Browse files

Unified · Split

libavcodec/libx265.c+18−1
@@ -504,6 +504,16 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 503 unmodified lines
504504 ret = libx265_encode_set_roi(ctx, pic, &x265pic);
505505 if (ret < 0)
506506 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+ }
507517 }
508518
509519 ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
@@ -570,6 +580,12 @@ FF_ENABLE_DEPRECATION_WARNINGS · 60 unmodified lines
570580
571581 ff_side_data_set_encoder_stats(pkt, x265pic_out.frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type);
572582
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+
573589 *got_packet = 1;
574590 return 0;
575591 }
@@ -683,6 +699,7 @@ AVCodec ff_libx265_encoder = { · 107 unmodified lines
683699 .priv_data_size = sizeof(libx265Context),
684700 .priv_class = &class,
685701 .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,
687704 .wrapper_name = "libx265",
688705 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t