int comp_page = 0, anc_page = 0; /* initialize to kill warnings */
char language[4] = {0}; /* initialize to kill warnings */
int has_hdmv_descr = 0;
+ int has_dirac_descr = 0;
#ifdef DEBUG_SI
av_log(ts->stream, AV_LOG_DEBUG, "PMT: len %i\n", section_len);
language[2] = get8(&p, desc_end);
language[3] = 0;
break;
+ case REGISTRATION_DESCRIPTOR: /*MPEG-2 Registration descriptor */
+ {
+ uint8_t bytes[4];
+ bytes[0] = get8(&p, desc_end);
+ bytes[1] = get8(&p, desc_end);
+ bytes[2] = get8(&p, desc_end);
+ bytes[3] = get8(&p, desc_end);
+ if(bytes[0] == 'd' && bytes[1] == 'r' &&
+ bytes[2] == 'a' && bytes[3] == 'c')
+ has_dirac_descr = 1;
+ break;
+ }
default:
break;
}
case STREAM_TYPE_VIDEO_MPEG4:
case STREAM_TYPE_VIDEO_H264:
case STREAM_TYPE_VIDEO_VC1:
+ case STREAM_TYPE_VIDEO_DIRAC:
case STREAM_TYPE_AUDIO_AAC:
case STREAM_TYPE_AUDIO_AC3:
case STREAM_TYPE_AUDIO_DTS:
case STREAM_TYPE_AUDIO_HDMV_DTS:
case STREAM_TYPE_SUBTITLE_DVB:
- if(stream_type == STREAM_TYPE_AUDIO_HDMV_DTS && !has_hdmv_descr)
+ if((stream_type == STREAM_TYPE_AUDIO_HDMV_DTS && !has_hdmv_descr)
+ || (stream_type == STREAM_TYPE_VIDEO_DIRAC && !has_dirac_descr))
break;
if(ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES){
pes= ts->pids[pid]->u.pes_filter.opaque;
codec_type = CODEC_TYPE_VIDEO;
codec_id = CODEC_ID_VC1;
break;
+ case STREAM_TYPE_VIDEO_DIRAC:
+ codec_type = CODEC_TYPE_VIDEO;
+ codec_id = CODEC_ID_DIRAC;
+ break;
case STREAM_TYPE_AUDIO_AAC:
codec_type = CODEC_TYPE_AUDIO;
codec_id = CODEC_ID_AAC;
case CODEC_ID_H264:
stream_type = STREAM_TYPE_VIDEO_H264;
break;
+ case CODEC_ID_DIRAC:
+ stream_type = STREAM_TYPE_VIDEO_DIRAC;
+ break;
case CODEC_ID_MP2:
case CODEC_ID_MP3:
stream_type = STREAM_TYPE_AUDIO_MPEG1;
put16(&q, 1); /* ancillary page id */
}
break;
+ case CODEC_TYPE_VIDEO:
+ if (stream_type == STREAM_TYPE_VIDEO_DIRAC) {
+ *q++ = 0x05; /*MPEG-2 registration descriptor*/
+ *q++ = 4;
+ *q++ = 'd';
+ *q++ = 'r';
+ *q++ = 'a';
+ *q++ = 'c';
+ }
+ break;
}
val = 0xf000 | (q - desc_length_ptr - 2);
*q++ = 0;
}
if (is_start) {
+ int pes_extension = 0;
/* write PES header */
*q++ = 0x00;
*q++ = 0x00;
*q++ = 0x01;
private_code = 0;
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
- *q++ = 0xe0;
+ if (st->codec->codec_id == CODEC_ID_DIRAC) {
+ *q++ = 0xfd;
+ } else
+ *q++ = 0xe0;
} else if (st->codec->codec_type == CODEC_TYPE_AUDIO &&
(st->codec->codec_id == CODEC_ID_MP2 ||
st->codec->codec_id == CODEC_ID_MP3)) {
header_len += 5;
flags |= 0x40;
}
+ if (st->codec->codec_type == CODEC_TYPE_VIDEO &&
+ st->codec->codec_id == CODEC_ID_DIRAC) {
+ /* set PES_extension_flag */
+ pes_extension = 1;
+ flags |= 0x01;
+
+ /*
+ * One byte for PES2 extension flag +
+ * one byte for extension length +
+ * one byte for extension id
+ */
+ header_len += 3;
+ }
len = payload_size + header_len + 3;
if (private_code != 0)
len++;
write_pts(q, 1, dts);
q += 5;
}
+ if (pes_extension && st->codec->codec_id == CODEC_ID_DIRAC) {
+ flags = 0x01; /* set PES_extension_flag_2 */
+ *q++ = flags;
+ *q++ = 0x80 | 0x01; /* marker bit + extension length */
+ /*
+ * Set the stream id extension flag bit to 0 and
+ * write the extended stream id
+ */
+ *q++ = 0x00 | 0x60;
+ }
if (private_code != 0)
*q++ = private_code;
is_start = 0;