aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2016-03-26 12:02:49 +0100
committerStefano Sabatini <stefasab@gmail.com>2016-05-19 18:26:32 +0200
commit1ab8e03a457a01df11eeb6ee13a0ca66f07ff863 (patch)
treedd52aab3a1e4237c1f954a9b78589319fbecabb3
parent7ecfe4dc363435c81e66dd14881dc0b0ccc73fb1 (diff)
downloadffmpeg-1ab8e03a457a01df11eeb6ee13a0ca66f07ff863.tar.gz
lavf/mpegtsenc: set metadata stream type and write descriptor for ID3 packets
This allow to remux data packets which are then recognized as ID3 packets.
-rw-r--r--libavformat/mpegts.h1
-rw-r--r--libavformat/mpegtsenc.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
index 0cdbc76b37..88b504d955 100644
--- a/libavformat/mpegts.h
+++ b/libavformat/mpegts.h
@@ -51,6 +51,7 @@
#define STREAM_TYPE_AUDIO_AAC 0x0f
#define STREAM_TYPE_AUDIO_AAC_LATM 0x11
#define STREAM_TYPE_VIDEO_MPEG4 0x10
+#define STREAM_TYPE_METADATA 0x15
#define STREAM_TYPE_VIDEO_H264 0x1b
#define STREAM_TYPE_VIDEO_HEVC 0x24
#define STREAM_TYPE_VIDEO_CAVS 0x42
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 8be24faefa..93cbac1d00 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -353,6 +353,9 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
case AV_CODEC_ID_OPUS:
stream_type = STREAM_TYPE_PRIVATE_DATA;
break;
+ case AV_CODEC_ID_TIMED_ID3:
+ stream_type = STREAM_TYPE_METADATA;
+ break;
default:
stream_type = STREAM_TYPE_PRIVATE_DATA;
break;
@@ -605,6 +608,13 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
*q++ = 'L';
*q++ = 'V';
*q++ = 'A';
+ } else if (st->codecpar->codec_id == AV_CODEC_ID_TIMED_ID3) {
+ *q++ = 0x5; /* MPEG-2 registration descriptor */
+ *q++ = 4;
+ *q++ = 'I';
+ *q++ = 'D';
+ *q++ = '3';
+ *q++ = ' ';
}
break;
}