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>
release/5.1
Andreas Rheinhardt 3 years ago
parent 8318627558
commit f9b8b89b75
  1. 7
      libavformat/matroskaenc.c

@ -2427,13 +2427,10 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb,
mkv->cluster_pos, track_number, keyframe != 0); mkv->cluster_pos, track_number, keyframe != 0);
#if CONFIG_MATROSKA_MUXER #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)) { (AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1)) {
err = ff_avc_parse_nal_units_buf(pkt->data, &data, &size); 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 } else
#endif #endif
if (track->reformat) { if (track->reformat) {

Loading…
Cancel
Save