Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/mpegtsenc: add descriptors to synchronous KLV in mpegts
@ 2022-03-14 16:32 Daniel Riehm
  0 siblings, 0 replies; only message in thread
From: Daniel Riehm @ 2022-03-14 16:32 UTC (permalink / raw)
  To: ffmpeg-devel

The metadata_descriptor and metadata_std_descriptor structures are
defined by ISO/IEC 13818-1, Sections 2.6.61 and 2.6.62. Their inclusion
in the PMT is motivated and required by MISB ST1402.2: Section 9.4.1:
Requirements 15, 16, 17.

Signed-off-by: Daniel Riehm <daniel.riehm@kitware.com>
---
 libavformat/mpegtsenc.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 20dce56122..0f11f0827d 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -797,6 +797,29 @@ static int mpegts_write_pmt(AVFormatContext *s,
MpegTSService *service)
         case AVMEDIA_TYPE_DATA:
             if (codec_id == AV_CODEC_ID_SMPTE_KLV) {
                 put_registration_descriptor(&q, MKTAG('K', 'L', 'V', 'A'));
+
+                if(st->codecpar->profile == FF_PROFILE_KLVA_SYNC) {
+                    const char *tag = "KLVA";
+                    *q++ = METADATA_DESCRIPTOR;
+                    *q++ = 9;                     /* descriptor_length */
+                    put16(&q, 0x0100);            /*
metadata_application_format */
+                    *q++ = 0xff;                  /* metadata_format */
+                    putbuf(&q, tag, strlen(tag)); /*
metadata_format_identifier */
+                    *q++ = 0x00;                  /* metadata_service_id */
+                    *q++ = 0x0f;                  /*
decoder_config_flags|DSM-CC_flag|reserved */
+
+                    *q++ = METADATA_STD_DESCRIPTOR;
+                    *q++ = 9;    /* descriptor_length */
+                    *q++ = 0xc0; /* reserved|metadata_input_leak_rate */
+                    *q++ = 0x00;
+                    *q++ = 0x00;
+                    *q++ = 0xc0; /* reserved|metadata_buffer_size */
+                    *q++ = 0x00;
+                    *q++ = 0x00;
+                    *q++ = 0xc0; /* reserved|metadata_output_leak_rate */
+                    *q++ = 0x00;
+                    *q++ = 0x00;
+                }
             } else if (codec_id == AV_CODEC_ID_TIMED_ID3) {
                 const char *tag = "ID3 ";
                 *q++ = METADATA_DESCRIPTOR;
-- 
2.25.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-14 16:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 16:32 [FFmpeg-devel] [PATCH] avformat/mpegtsenc: add descriptors to synchronous KLV in mpegts Daniel Riehm

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git