Add better support for H.265

master
John Cox 2015-08-04 15:52:22 +01:00
rodzic 77f94dff7e
commit 08771c6326
3 zmienionych plików z 130 dodań i 42 usunięć

84
h222.c
Wyświetl plik

@ -31,48 +31,48 @@
extern const char *h222_stream_type_str(unsigned s)
{
if ((0x1C < s) && (s < 0x7E))
return "H.220.0/13818-1 reserved";
else if ((0x80 <= s) && (s <= 0xFF))
return "User private";
else
switch (s)
{
case 0x00: return "Reserved";
case 0x01: return "11172-2 video (MPEG-1)";
case 0x02: return "H.262/13818-2 video (MPEG-2) or 11172-2 constrained video";
case 0x03: return "11172-3 audio (MPEG-1)";
case 0x04: return "13818-3 audio (MPEG-2)";
case 0x05: return "H.222.0/13818-1 private sections";
case 0x06: return "H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)";
case 0x07: return "13522 MHEG";
case 0x08: return "H.222.0/13818-1 Annex A - DSM CC";
case 0x09: return "H.222.1";
case 0x0A: return "13818-6 type A";
case 0x0B: return "13818-6 type B";
case 0x0C: return "13818-6 type C";
case 0x0D: return "13818-6 type D";
case 0x0E: return "H.222.0/13818-1 auxiliary";
case 0x0F: return "13818-7 Audio with ADTS transport syntax";
case 0x10: return "14496-2 Visual (MPEG-4 part 2 video)";
case 0x11: return "14496-3 Audio with LATM transport syntax (14496-3/AMD 1)";
case 0x12: return "14496-1 SL-packetized or FlexMux stream in PES packets";
case 0x13: return "14496-1 SL-packetized or FlexMux stream in 14496 sections";
case 0x14: return "ISO/IEC 13818-6 Synchronized Download Protocol";
case 0x15: return "Metadata in PES packets";
case 0x16: return "Metadata in metadata_sections";
case 0x17: return "Metadata in 13818-6 Data Carousel";
case 0x18: return "Metadata in 13818-6 Object Carousel";
case 0x19: return "Metadata in 13818-6 Synchronized Download Protocol";
case 0x1A: return "13818-11 MPEG-2 IPMP stream";
case 0x1B: return "H.264/14496-10 video (MPEG-4/AVC)";
case 0x24: return "HEVC video stream";
case 0x25: return "HEVC temporal video subset (profile Annex A H.265)";
case 0x42: return "AVS Video";
case 0x7F: return "IPMP stream";
case 0x81: return "User private (commonly Dolby/AC-3 in ATSC)";
default: return "Unrecognised";
}
switch (s)
{
case 0x00: return "Reserved";
case 0x01: return "11172-2 video (MPEG-1)";
case 0x02: return "H.262/13818-2 video (MPEG-2) or 11172-2 constrained video";
case 0x03: return "11172-3 audio (MPEG-1)";
case 0x04: return "13818-3 audio (MPEG-2)";
case 0x05: return "H.222.0/13818-1 private sections";
case 0x06: return "H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)";
case 0x07: return "13522 MHEG";
case 0x08: return "H.222.0/13818-1 Annex A - DSM CC";
case 0x09: return "H.222.1";
case 0x0A: return "13818-6 type A";
case 0x0B: return "13818-6 type B";
case 0x0C: return "13818-6 type C";
case 0x0D: return "13818-6 type D";
case 0x0E: return "H.222.0/13818-1 auxiliary";
case 0x0F: return "13818-7 Audio with ADTS transport syntax";
case 0x10: return "14496-2 Visual (MPEG-4 part 2 video)";
case 0x11: return "14496-3 Audio with LATM transport syntax (14496-3/AMD 1)";
case 0x12: return "14496-1 SL-packetized or FlexMux stream in PES packets";
case 0x13: return "14496-1 SL-packetized or FlexMux stream in 14496 sections";
case 0x14: return "ISO/IEC 13818-6 Synchronized Download Protocol";
case 0x15: return "Metadata in PES packets";
case 0x16: return "Metadata in metadata_sections";
case 0x17: return "Metadata in 13818-6 Data Carousel";
case 0x18: return "Metadata in 13818-6 Object Carousel";
case 0x19: return "Metadata in 13818-6 Synchronized Download Protocol";
case 0x1A: return "13818-11 MPEG-2 IPMP stream";
case 0x1B: return "H.264/14496-10 video (MPEG-4/AVC)";
case 0x24: return "HEVC video stream";
case 0x25: return "HEVC temporal video subset (profile Annex A H.265)";
case 0x42: return "AVS Video";
case 0x7F: return "IPMP stream";
case 0x81: return "User private (commonly Dolby/AC-3 in ATSC)";
default:
if ((0x1C < s) && (s < 0x7E))
return "H.220.0/13818-1 reserved";
else if ((0x80 <= s) && (s <= 0xFF))
return "User private";
return "Unrecognised";
}
}
// Local Variables:

Wyświetl plik

@ -92,6 +92,7 @@
#define ADTS_AUDIO_STREAM_TYPE 0x0F // AAC ADTS
#define MPEG4_PART2_VIDEO_STREAM_TYPE 0x10
#define LATM_AUDIO_STREAM_TYPE 0x11 // How much do we support this?
#define H265_VIDEO_STREAM_TYPE 0x24
#define DOLBY_DVB_STREAM_TYPE 0x06 // [1]
#define DOLBY_ATSC_STREAM_TYPE 0x81 // [1]
@ -106,6 +107,7 @@
#define IS_VIDEO_STREAM_TYPE(s) ((s)==MPEG1_VIDEO_STREAM_TYPE || \
(s)==MPEG2_VIDEO_STREAM_TYPE || \
(s)==AVC_VIDEO_STREAM_TYPE || \
(s)==H265_VIDEO_STREAM_TYPE || \
(s)==AVS_VIDEO_STREAM_TYPE || \
(s)==MPEG4_PART2_VIDEO_STREAM_TYPE)

86
ts.c
Wyświetl plik

@ -2469,6 +2469,88 @@ too_short:
fprint_msg_or_err(is_msg, "; ### block short ###\n");
}
static void print_HEVC_descriptor(const int is_msg, const byte * const buf, const int len)
{
const uint8_t * p = buf;
const byte * const eop = p + len;
static const char * const prog_interlace[4] = {
"unknown scan source",
"interlaced source",
"progressive source",
"mixed scan source"
};
if (len == 9)
{
// I've seen a number of these but I can't find a standard
print_data(is_msg, "HEVC video descriptor ### bad length", buf, len ,100);
return;
}
fprint_msg_or_err(is_msg, "HEVC video descriptor:");
if (p >= eop)
{
goto too_short;
}
fprint_msg_or_err(is_msg, " profile_space=%d, tier_flag=%d, profile_idc=%d", *p >> 6, (*p >> 5) & 1, *p & 0x1f);
if (++p + 3 >= eop)
{
goto too_short;
}
fprint_msg_or_err(is_msg, ", profile_compatability=%#08x", uint_32_be(p));
if ((p += 4) + 5 >= eop)
{
goto too_short;
}
fprint_msg_or_err(is_msg, ", %s%s%s", prog_interlace[*p >> 6], *p & 0x20 ? ", non_packed" : "", *p & 0x10 ? ", frame_only" : "");
if ((*p & 0xf) != 0 || p[1] != 0 || p[2] != 0 || p[3] != 0 || p[4] != 0 || p[5] != 0)
{
fprint_msg_or_err(is_msg, ", ### reserved_zero_44bits=0x%x%02x%08x", *p & 0xf, p[1], uint_32_be(p + 2));
}
if ((p += 6) >= eop)
{
goto too_short;
}
fprint_msg_or_err(is_msg, ", level=%d.%d", *p / 30, *p % 30);
if (++p >= eop)
{
goto too_short;
}
fprint_msg_or_err(is_msg, "%s%s", *p & 0x40 ? ", still" : "", *p & 0x20 ? ", 24hr" : "");
if ((*p & 0x1f) != 0x1f)
{
fprint_msg_or_err(is_msg, ", ### reserved=%#02x", *p & 0x1f);
}
if ((*p++ & 0x80) != 0)
{
fprint_msg_or_err(is_msg, ", temporal_id");
if (p + 2 >= eop)
{
goto too_short;
}
if ((*p >> 3) != 0x1f)
{
fprint_msg_or_err(is_msg, " ### reserved=%#02x", *p & 0x1f);
}
fprint_msg_or_err(is_msg, " min=%d", *p & 7);
++p;
if ((*p >> 3) != 0x1f)
{
fprint_msg_or_err(is_msg, " ### reserved=%#02x", *p & 0x1f);
}
fprint_msg_or_err(is_msg, " max=%d", *p & 7);
++p;
}
fprint_msg_or_err(is_msg,"\n");
return;
too_short:
fprint_msg_or_err(is_msg, "; ### block short ###\n");
}
/*
* Print out information about program descriptors
* (either from the PMT program info, or the PMT/stream ES info)
@ -2702,6 +2784,10 @@ extern int print_descriptors(int is_msg,
fprint_msg_or_err(is_msg,"\n");
break;
case 56:
print_HEVC_descriptor(is_msg, data, this_length);
break;
case 0x56: // teletext
for (ii = 0; ii < this_length; ii += 5)
{