[libav-devel] [PATCH 1/2] avcodec/libx265: fill headers in extradata
From: Michael Niedermayer michae...@gmx.at This allows muxing properly into Matroska and MP4. Signed-off-by: Michael Niedermayer michae...@gmx.at Signed-off-by: Derek Buitenhuis derek.buitenh...@gmail.com --- libavcodec/libx265.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index a6e4193..1cc1d71 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -190,10 +190,11 @@ 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); + Cannot allocate HEVC header of size %d (%d with padding).\n, + ctx-header_size, ctx-header_size + FF_INPUT_BUFFER_PADDING_SIZE); libx265_encode_close(avctx); return AVERROR(ENOMEM); } @@ -204,6 +205,14 @@ 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; } -- 1.9.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] avcodec/libx265: fill headers in extradata
On Sun, Mar 23, 2014 at 02:36:06PM +, Derek Buitenhuis wrote: From: Michael Niedermayer michae...@gmx.at This allows muxing properly into Matroska and MP4. Signed-off-by: Michael Niedermayer michae...@gmx.at Signed-off-by: Derek Buitenhuis derek.buitenh...@gmail.com --- libavcodec/libx265.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) Use just libx265: as subject prefix. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] avcodec/libx265: fill headers in extradata
On 23 Mar 2014, at 15:36, Derek Buitenhuis derek.buitenh...@gmail.com wrote: From: Michael Niedermayer michae...@gmx.at This allows muxing properly into Matroska and MP4. Signed-off-by: Michael Niedermayer michae...@gmx.at Signed-off-by: Derek Buitenhuis derek.buitenh...@gmail.com --- libavcodec/libx265.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) AFAICT, neither your nor Luca's backport seem to free the context extradata. Most (if not all) encoders seem to do this. Tim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] avcodec/libx265: fill headers in extradata
On 3/23/2014 5:09 PM, Tim Walker wrote: AFAICT, neither your nor Luca's backport seem to free the context extradata. For some reason I was under the impression that it was done automatically. - Derek ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] avcodec/libx265: fill headers in extradata
On 23 Mar 2014, at 18:29, Derek Buitenhuis derek.buitenh...@gmail.com wrote: On 3/23/2014 5:09 PM, Tim Walker wrote: AFAICT, neither your nor Luca's backport seem to free the context extradata. For some reason I was under the impression that it was done automatically. - Derek Looks like it, though an awful lot of encoders free it explicitly anyway. Tim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel