---
libavcodec/avcodec.h | 1 +
libavcodec/codec_desc.c | 6 ++++++
libavformat/mpegtsenc.c | 22 ++++++++++++++++++++++
3 files changed, 29 insertions(+)
@@ -683,6 +683,7 @@ enum AVCodecID {
AV_CODEC_ID_DVD_NAV,
AV_CODEC_ID_TIMED_ID3,
AV_CODEC_ID_BIN_DATA,
+ AV_CODEC_ID_SYNCHRONOUS_METADATA,
AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
@@ -3114,6 +3114,12 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "scte_35",
.long_name = NULL_IF_CONFIG_SMALL("SCTE 35 Message Queue"),
},
+ {
+ .id = AV_CODEC_ID_SYNCHRONOUS_METADATA,
+ .type = AVMEDIA_TYPE_DATA,
+ .name = "sync_metadata",
+ .long_name = NULL_IF_CONFIG_SMALL("ISO/IEC 13818-1 Synchronous Metadata"),
+ },
/* deprecated codec ids */
};
@@ -387,6 +387,7 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
stream_type = STREAM_TYPE_PRIVATE_DATA;
break;
case AV_CODEC_ID_TIMED_ID3:
+ case AV_CODEC_ID_SYNCHRONOUS_METADATA:
stream_type = STREAM_TYPE_METADATA;
break;
default:
@@ -641,6 +642,27 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
*q++ = 'L';
*q++ = 'V';
*q++ = 'A';
+ } else if (st->codecpar->codec_id == AV_CODEC_ID_SYNCHRONOUS_METADATA) {
+ const char *tag = "KLVA";
+ *q++ = 0x26; /* desctiptor_tag = metadata_descriptor */
+ *q++ = 9; /* desctiptor_length */
+ put16(&q, 0x0100); /* metadata application format */
+ *q++ = 0xff; /* metadata format */
+ putstr8(&q, tag, 0);
+ *q++ = 0; /* metadata service ID */
+ *q++ = 0xF; /* decoder_config_flags|DSM-CC flag|reserved */
+
+ *q++ = 0x27; /* desctiptor_tag = metadata_std_descriptor */
+ *q++ = 9; /* desctiptor_length */
+ *q++ = 0xc0;
+ *q++ = 0x00;
+ *q++ = 0x00;
+ *q++ = 0xc0;
+ *q++ = 0x00;
+ *q++ = 0x00;
+ *q++ = 0xc0;
+ *q++ = 0x00;
+ *q++ = 0x00;
} else if (st->codecpar->codec_id == AV_CODEC_ID_TIMED_ID3) {
const char *tag = "ID3 ";
*q++ = 0x26; /* metadata descriptor */
--
2.7.4