diff mbox

[FFmpeg-devel] mpegtsenc add synchronous metadata - retry

Message ID CA+F=gyO3VJoRRBF2Z=PrSY7aXOMm+LMCWEf44cysuCxDTWcD9A@mail.gmail.com
State New
Headers show

Commit Message

Mark Timmerman Aug. 2, 2017, 8:40 a.m. UTC
Add synchronous metadata to mpegtsenc
* Added AV_CODEC_ID_SYNCHRONOUS_METADATA
* PMT will have metadata_descriptor and metadata_std_descriptor
  in accordance with MISB ST 1402.2
* stream_type will be 0x15 metadata carried in PES packets
* stream_id will be 0xfc metadata stream

Users must supply Metadata Access Unit to the packet before writing.
---
 libavcodec/avcodec.h    |  1 +
 libavformat/mpegtsenc.c | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)

         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 */

Comments

Moritz Barsnick Aug. 15, 2017, 6:57 p.m. UTC | #1
On Wed, Aug 02, 2017 at 10:40:48 +0200, Mark Timmerman wrote:
> +            } else if (st->codecpar->codec_id ==
> AV_CODEC_ID_SYNCHRONOUS_METADATA) {

Again, your patch is corrupted by newlines. Please use git send-email
(preferred), or use git format-patch to create a patch to attach.

Otherwise, chances for a review are low.

Moritz
diff mbox

Patch

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c594993..fe4e538 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -682,6 +682,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
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index fdfa544..35907da 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -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;