[x265] [PATCH] api: add param.bRepeatHeaders - insert stream headers in each keyframe NAL

Tim Walker tdskywalker at gmail.com
Wed Mar 26 12:26:45 CET 2014


On 25 Mar 2014, at 17:43, Steve Borho <steve at borho.org> wrote:

> # HG changeset patch
> # User Steve Borho <steve at borho.org>
> # Date 1395765782 18000
> #      Tue Mar 25 11:43:02 2014 -0500
> # Node ID e739e579609a0bc11ef72368ab39c824411d1d7b
> # Parent  4318d47d934857a5d0a5e2a8dc0eaed48f086197
> api: add param.bRepeatHeaders - insert stream headers in each keyframe NAL

Semi-related: x265_encoder_headers returns 0 on success, whereas x264_encoder_headers returns the size of the provided NAL units. Since all NAL units are already guaranteed by the x265 API to be contiguous in memory, returning the size would allow to simplify copying of returned headers, like this:

x265_encoder *x265_handle;
[…]
uint8_t  *buf;
x265_nal *nal;
uint32_t nnal;

int size = x265_encoder_headers(x265_handle, &nal, &nnal);
if (size <= 0)
    // handle errors

buf = malloc(size);
if (!buf)
    // handle errors

memcpy(buf, nal->payload, size);

…instead of having to loop over the NAL array to compute the size manually.

Tim


More information about the x265-devel mailing list