You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
libx265: Write global extradata when requested
Matroska, MP4, and other containers require it. Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
committed by
Derek Buitenhuis
parent
8ef33497a6
commit
60728e8bab
@@ -190,7 +190,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
|
|||||||
for (i = 0; i < nnal; i++)
|
for (i = 0; i < nnal; i++)
|
||||||
ctx->header_size += nal[i].sizeBytes;
|
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) {
|
if (!ctx->header) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Cannot allocate HEVC header of size %d.\n", ctx->header_size);
|
"Cannot allocate HEVC header of size %d.\n", ctx->header_size);
|
||||||
@@ -204,6 +204,14 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
|
|||||||
buf += nal[i].sizeBytes;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user