0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2025-01-19 02:32:07 +00:00
Lakka-LibreELEC/projects/Amlogic/patches/ffmpeg/ffmpeg-0009-matroskaenc-Assume-H264-is-Annex-B-if-no-extradata.patch
Christian Hewitt 23942f808a ffmpeg: update Amlogic patches with recent commits from test/5.1.4/main
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
2024-03-24 14:58:21 +00:00

35 lines
1.4 KiB
Diff

From 97c735a3fc0976aa50d819a2f397e9467228722d Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Thu, 1 Feb 2024 18:12:38 +0000
Subject: [PATCH 09/14] matroskaenc: Assume H264 is Annex B if no extradata
---
libavformat/matroskaenc.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index a6a00f03e7..131ad31d1b 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -3194,9 +3194,15 @@ static int mkv_init(struct AVFormatContext *s)
track->reformat = mkv_reformat_wavpack;
break;
case AV_CODEC_ID_H264:
+ // Default to reformat if no extradata as the only current
+ // encoder which does this is v4l2m2m which needs reformat
+ if (par->extradata_size == 0 ||
+ (par->extradata_size > 3 &&
+ (AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1)))
+ track->reformat = mkv_reformat_h2645;
+ break;
case AV_CODEC_ID_HEVC:
- if ((par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 0 ||
- par->codec_id == AV_CODEC_ID_HEVC && par->extradata_size > 6) &&
+ if (par->extradata_size > 6 &&
(AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1))
track->reformat = mkv_reformat_h2645;
break;
--
2.34.1