Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
libavformat/mpegts.c: fix hardcoded 5-bytes skip for metadata streams.
Before the introduction of AV_CODEC_ID_TIMED_ID3 for timed_id3 metadata streams
in mpegts (commit 4a4437c), AV_CODEC_ID_SMPTE_KLV
was the only existing codec for metadata.

It seems that this codec has a 5-bytes metadata header[1] that, for some reason,
was always skipped when decoding data packets.

However, when working with a AV_CODEC_ID_TIMED_ID3 streams, this results in the
5 first bytes of the payload being cut-off, which includes essential informations
such as the ID3 tag version.

This patch fixes the issue by keeping the 5-bytes skip only for AV_CODEC_ID_SMPTE_KLV
streams.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
  • Loading branch information
toots authored and jamrial committed Jun 21, 2023
1 parent 98cae37 commit 468615f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libavformat/mpegts.c
Expand Up @@ -1305,7 +1305,7 @@ static int mpegts_push_data(MpegTSFilter *filter,
p += sl_header_bytes;
buf_size -= sl_header_bytes;
}
if (pes->stream_type == 0x15 && buf_size >= 5) {
if (pes->st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV && buf_size >= 5) {
/* skip metadata access unit header */
pes->pes_header_size += 5;
p += 5;
Expand Down

0 comments on commit 468615f

Please sign in to comment.