@@ -357,6 +357,7 @@ static int get_dvb_stream_type(AVFormatContext *s, AVStream *st)
break;
case AV_CODEC_ID_DVB_SUBTITLE:
case AV_CODEC_ID_DVB_TELETEXT:
+ case AV_CODEC_ID_ARIB_CAPTION:
stream_type = STREAM_TYPE_PRIVATE_DATA;
break;
case AV_CODEC_ID_SMPTE_KLV:
@@ -714,8 +715,21 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
}
*len_ptr = q - len_ptr - 1;
+ } else if (codec_id == AV_CODEC_ID_ARIB_CAPTION) {
+ if (st->codecpar->extradata && st->codecpar->extradata_size >= 4) {
+ // stream_identifier_descriptor
+ *q++ = 0x52; // descriptor_tag
+ *q++ = 1; // descriptor_length
+ *q++ = st->codecpar->extradata[0]; // component_tag: stream_identifier
+
+ // data_component_descriptor
+ *q++ = 0xFD; // descriptor_tag: ARIB data coding type descriptor
+ *q++ = 3; // descriptor_length
+ memcpy(q, &st->codecpar->extradata[1], 3); // data_component_id & additional_arib_caption_info
+ q += 3;
+ }
}
- break;
+ break;
case AVMEDIA_TYPE_VIDEO:
if (stream_type == STREAM_TYPE_VIDEO_DIRAC) {
put_registration_descriptor(&q, MKTAG('d', 'r', 'a', 'c'));
Stream copy for arib_caption into mpegts is not working correctly for now. This patch utilizes the data stored in codecpar->extradata to write necessary stream_identifier_descriptor and data_component_descriptor into PMT table for arib_caption remuxing. This patch fixes the copying of arib_caption. After this patch, arib_caption inside the outputted (remuxed) mpegts stream can be recognized correctly as an arib_caption subtitle stream. Signed-off-by: zheng qian <xqq@xqq.im> --- libavformat/mpegtsenc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)