add support for H265

This commit is contained in:
TangoCash
2016-07-31 21:28:53 +02:00
committed by Thilo Graf
parent e1349234f6
commit 29221aaca5
3 changed files with 34 additions and 12 deletions

View File

@@ -459,7 +459,7 @@ void CStreamManager::AddPids(int fd, CZapitChannel *channel, stream_pids_t &pids
for (stream_pids_t::iterator it = pids.begin(); it != pids.end(); ++it) { for (stream_pids_t::iterator it = pids.begin(); it != pids.end(); ++it) {
if (*it == channel->getVideoPid()) { if (*it == channel->getVideoPid()) {
printf("CStreamManager::AddPids: genpsi vpid %x (%d)\n", *it, channel->type); printf("CStreamManager::AddPids: genpsi vpid %x (%d)\n", *it, channel->type);
psi.addPid(*it, channel->type == 1 ? EN_TYPE_AVC : channel->type == 2 ? EN_TYPE_HEVC : EN_TYPE_VIDEO, 0); psi.addPid(*it, channel->type == CHANNEL_MPEG4 ? EN_TYPE_AVC : channel->type == CHANNEL_HEVC ? EN_TYPE_HEVC : EN_TYPE_VIDEO, 0);
} else { } else {
for (int i = 0; i < channel->getAudioChannelCount(); i++) { for (int i = 0; i < channel->getAudioChannelCount(); i++) {
if (*it == channel->getAudioChannel(i)->pid) { if (*it == channel->getAudioChannel(i)->pid) {

View File

@@ -89,4 +89,11 @@ typedef struct TP_parameter
FrontendParameters feparams; FrontendParameters feparams;
} TP_params; } TP_params;
enum ChannelType {
CHANNEL_MPEG2 = 0,
CHANNEL_MPEG4 = 1,
CHANNEL_HEVC = 6,
CHANNEL_CAVS = 16
};
#endif /* __zapittypes_h__ */ #endif /* __zapittypes_h__ */

View File

@@ -263,29 +263,44 @@ bool CPmt::ParseEsInfo(ElementaryStreamInfo *esinfo, CZapitChannel * const chann
} }
} }
switch (stream_type) { switch (stream_type) {
case 0x01: case 0x01: // MPEG1 Video
case 0x02: case 0x02: // MPEG2 Video (H262)
case 0x24: channel->setVideoPid(esinfo->getPid());
channel->type = CHANNEL_MPEG2;
DBG("[pmt] vpid %04x stream %d type %d\n", esinfo->getPid(), stream_type, channel->type);
break;
case 0x10: // AVC Video Stream (MPEG4 H263)
case 0x1b: // AVC Video Stream (MPEG4 H264) case 0x1b: // AVC Video Stream (MPEG4 H264)
channel->setVideoPid(esinfo->getPid()); channel->setVideoPid(esinfo->getPid());
channel->type = (stream_type == 0x1b) ? 1 : (stream_type == 0x24) ? 2 : 0; //FIXME channel->type = CHANNEL_MPEG4;
printf("[pmt] vpid %04x stream %d type %d\n", esinfo->getPid(), stream_type, channel->type); DBG("[pmt] vpid %04x stream %d type %d\n", esinfo->getPid(), stream_type, channel->type);
break; break;
case 0x03: case 0x24: // HEVC Video Stream (MPEG4 H265)
case 0x04: case 0x27: // SHVC Video Stream (MPEG4 H265 TS)
channel->setVideoPid(esinfo->getPid());
channel->type = CHANNEL_HEVC;
DBG("[pmt] vpid %04x stream %d type %d\n", esinfo->getPid(), stream_type, channel->type);
break;
case 0x42: // CAVS Video Stream (China)
channel->setVideoPid(esinfo->getPid());
channel->type = CHANNEL_CAVS;
DBG("[pmt] vpid %04x stream %d type %d\n", esinfo->getPid(), stream_type, channel->type);
break;
case 0x03: // MPEG1 Audio
case 0x04: // MPEG2 Audio
audio_type = CZapitAudioChannel::MPEG; audio_type = CZapitAudioChannel::MPEG;
audio = true; audio = true;
break; break;
case 0x06: case 0x06: // MPEG2 Subtitiles
if(audio_type != CZapitAudioChannel::UNKNOWN) if(audio_type != CZapitAudioChannel::UNKNOWN)
audio = true; audio = true;
break; break;
case 0x0F: // AAC ADTS case 0x0F: // AAC ADTS (MPEG2)
case 0x11: // AAC LATM case 0x11: // AAC LATM (MPEG4)
audio_type = CZapitAudioChannel::AAC; audio_type = CZapitAudioChannel::AAC;
audio = true; audio = true;
break; break;
case 0x81: case 0x81: // Dolby Digital
audio_type = CZapitAudioChannel::AC3; audio_type = CZapitAudioChannel::AC3;
audio = true; audio = true;
break; break;