aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-14 04:26:24 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-15 02:42:11 +0100
commit125bea15d1f6248f4eb2131add7fc11e636f9455 (patch)
tree98a0c0d75c45352b8947e41f02768142a18f34b3
parent70e3cc282bee235a9f55fc2bd342fbe6f6c0f7ce (diff)
downloadffmpeg-125bea15d1f6248f4eb2131add7fc11e636f9455.tar.gz
avcodec/libx265: fill headers in extradata
Fixes Ticket3457 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit dded5ed9c5eb0c3d5a953e661ea21a9019e93ea4) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/libx265.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 2370601ed7..e03d72f968 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -190,7 +190,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
for (i = 0; i < nnal; i++)
ctx->header_size += nal[i].sizeBytes;
- ctx->header = av_malloc(ctx->header_size);
+ ctx->header = av_malloc(ctx->header_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!ctx->header) {
av_log(avctx, AV_LOG_ERROR,
"Cannot allocate HEVC header of size %d.\n", ctx->header_size);
@@ -204,6 +204,13 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
buf += nal[i].sizeBytes;
}
+ if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
+ avctx->extradata_size = ctx->header_size;
+ avctx->extradata = ctx->header;
+ ctx->header_size = 0;
+ ctx->header = NULL;
+ }
+
return 0;
}