avformat/matroskaenc: Use common function for H.2645 annex B->mp4

Matroska does not have different profiles that allow or disallow
in-band extradata, so one can just use the ordinary H.264 function
for H.265, too. (Both use ff_avc_parse_nal_units() internally anyway.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-01-16 00:23:50 +01:00
parent 8318627558
commit f9b8b89b75
1 changed files with 2 additions and 5 deletions

View File

@ -2427,13 +2427,10 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb,
mkv->cluster_pos, track_number, keyframe != 0);
#if CONFIG_MATROSKA_MUXER
if (par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 0 &&
if ((par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 0 ||
par->codec_id == AV_CODEC_ID_HEVC && par->extradata_size > 6) &&
(AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1)) {
err = ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
} else if (par->codec_id == AV_CODEC_ID_HEVC && par->extradata_size > 6 &&
(AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1)) {
/* extradata is Annex B, assume the bitstream is too and convert it */
err = ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL);
} else
#endif
if (track->reformat) {