rework audio_bypass / audio process

Origin commit data
------------------
Commit: 29300bde29
Author: TangoCash <eric@loxat.de>
Date: 2021-01-31 (Sun, 31 Jan 2021)
This commit is contained in:
TangoCash
2021-01-31 18:21:43 +01:00
committed by vanhofen
parent 1176fee87a
commit c744aee2aa
4 changed files with 95 additions and 31 deletions

View File

@@ -100,12 +100,14 @@ class CZapitAudioChannel
unsigned char componentTag;
enum ZapitAudioChannelType {
MPEG,
AC3,
AAC,
AACPLUS, //?
DTS,
EAC3,
MPEG = 1,
AC3 = 0,
AAC = 8,
AACPLUS = 9,
DTS = 2,
LPCM = 6,
DTSHD = 0x10,
EAC3 = 0x22,
UNKNOWN
};
ZapitAudioChannelType audioChannelType;

View File

@@ -45,4 +45,45 @@ class CPmt
bool haveCaSys(int pmtpid, int service_id);
};
/* registration_descriptor format IDs */
#define DRF_ID_HDMV 0x48444d56
#define DRF_ID_VC1 0x56432D31 /* defined in RP227 */
#define DRF_ID_DTS1 0x44545331
#define DRF_ID_DTS2 0x44545332
#define DRF_ID_DTS3 0x44545333
#define DRF_ID_S302M 0x42535344
#define DRF_ID_TSHV 0x54534856
#define DRF_ID_AC3 0x41432d33
#define DRF_ID_GA94 0x47413934
#define DRF_ID_CUEI 0x43554549
#define DRF_ID_ETV1 0x45545631
#define DRF_ID_HEVC 0x48455643
#define DRF_ID_KLVA 0x4b4c5641 /* defined in RP217 */
#define DRF_ID_OPUS 0x4f707573
#define DRF_ID_EAC3 0x45414333 /* defined in A/52 Annex G */
#define DRF_ID_AC4 0x41432D34 /* defined in ETSI TS 103 190-2 Annex D */
#define STREAM_TYPE_VIDEO_MPEG1 0x01
#define STREAM_TYPE_VIDEO_MPEG2 0x02
#define STREAM_TYPE_AUDIO_MPEG1 0x03
#define STREAM_TYPE_AUDIO_MPEG2 0x04
#define STREAM_TYPE_PRIVATE_SECTION 0x05
#define STREAM_TYPE_PRIVATE_DATA 0x06
#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_SHVC 0x27
#define STREAM_TYPE_VIDEO_CAVS 0x42
#define STREAM_TYPE_VIDEO_VC1 0xea
#define STREAM_TYPE_VIDEO_DIRAC 0xd1
#define STREAM_TYPE_AUDIO_AC3 0x81
#define STREAM_TYPE_AUDIO_DTS 0x82
#define STREAM_TYPE_AUDIO_LPCM 0x83
#define STREAM_TYPE_AUDIO_DTSHD 0x86
#define STREAM_TYPE_AUDIO_EAC3 0x87
#endif /* __zapit_scan_pmt_h__ */

View File

@@ -144,14 +144,17 @@ bool CPmt::ParseEsInfo(ElementaryStreamInfo *esinfo, CZapitChannel * const chann
{
RegistrationDescriptor *sd = (RegistrationDescriptor*) d;
switch (sd->getFormatIdentifier()) {
case 0x44545331:
case 0x44545332:
case 0x44545333:
case DRF_ID_DTS1:
case DRF_ID_DTS2:
case DRF_ID_DTS3:
audio_type = CZapitAudioChannel::DTS;
break;
case 0x41432d33:
case DRF_ID_AC3:
audio_type = CZapitAudioChannel::AC3;
break;
case DRF_ID_EAC3:
audio_type = CZapitAudioChannel::EAC3;
break;
default:
#ifdef DEBUG_PMT
printf("PMT: REGISTRATION_DESCRIPTOR: %x\n", sd->getFormatIdentifier());
@@ -263,50 +266,66 @@ bool CPmt::ParseEsInfo(ElementaryStreamInfo *esinfo, CZapitChannel * const chann
}
}
switch (stream_type) {
case 0x01: // MPEG1 Video
case 0x02: // MPEG2 Video (H262)
case STREAM_TYPE_VIDEO_MPEG1:
case STREAM_TYPE_VIDEO_MPEG2:
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 STREAM_TYPE_VIDEO_MPEG4:
case STREAM_TYPE_VIDEO_H264:
channel->setVideoPid(esinfo->getPid());
channel->type = CHANNEL_MPEG4;
DBG("[pmt] vpid %04x stream %d type %d\n", esinfo->getPid(), stream_type, channel->type);
break;
case 0x24: // HEVC Video Stream (MPEG4 H265)
case 0x27: // SHVC Video Stream (MPEG4 H265 TS)
case STREAM_TYPE_VIDEO_HEVC:
case STREAM_TYPE_VIDEO_SHVC:
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)
case STREAM_TYPE_VIDEO_CAVS:
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
case STREAM_TYPE_AUDIO_MPEG1:
case STREAM_TYPE_AUDIO_MPEG2:
audio_type = CZapitAudioChannel::MPEG;
audio = true;
break;
case 0x06: // MPEG2 Subtitiles
case STREAM_TYPE_PRIVATE_DATA: // MPEG2 Subtitles
if(audio_type != CZapitAudioChannel::UNKNOWN)
audio = true;
break;
case 0x0F: // AAC ADTS (MPEG2)
case STREAM_TYPE_AUDIO_AAC:
audio_type = CZapitAudioChannel::AAC;
audio = true;
break;
case 0x11: // AAC LATM (MPEG4)
case STREAM_TYPE_AUDIO_AAC_LATM:
audio_type = CZapitAudioChannel::AACPLUS;
audio = true;
break;
case 0x81: // Dolby Digital
case STREAM_TYPE_AUDIO_AC3:
audio_type = CZapitAudioChannel::AC3;
audio = true;
break;
case STREAM_TYPE_AUDIO_DTS:
audio_type = CZapitAudioChannel::DTS;
audio = true;
break;
case STREAM_TYPE_AUDIO_DTSHD:
audio_type = CZapitAudioChannel::DTSHD;
audio = true;
break;
case STREAM_TYPE_AUDIO_LPCM:
audio_type = CZapitAudioChannel::LPCM;
audio = true;
break;
case STREAM_TYPE_AUDIO_EAC3:
audio_type = CZapitAudioChannel::EAC3;
audio = true;
break;
default:
#ifdef DEBUG_PMT_UNUSED
printf("PMT: pid %04x stream_type: %02x\n", esinfo->getPid(), stream_type);

View File

@@ -945,33 +945,35 @@ void CZapit::SetAudioStreamType(CZapitAudioChannel::ZapitAudioChannelType audioC
switch (audioChannelType) {
case CZapitAudioChannel::AC3:
audioStr = "AC3";
audioDecoder->SetStreamType(AUDIO_FMT_DOLBY_DIGITAL);
break;
case CZapitAudioChannel::MPEG:
audioStr = "MPEG2";
audioDecoder->SetStreamType(AUDIO_FMT_MPEG);
break;
case CZapitAudioChannel::AAC:
audioStr = "AAC";
audioDecoder->SetStreamType(AUDIO_FMT_AAC);
break;
case CZapitAudioChannel::AACPLUS:
audioStr = "AAC-PLUS";
audioDecoder->SetStreamType(AUDIO_FMT_AAC_PLUS);
audioStr = "AAC-HE";
break;
case CZapitAudioChannel::DTS:
audioStr = "DTS";
audioDecoder->SetStreamType(AUDIO_FMT_DTS);
break;
case CZapitAudioChannel::DTSHD:
audioStr = "DTSHD";
break;
case CZapitAudioChannel::EAC3:
audioStr = "DD-PLUS";
audioDecoder->SetStreamType(AUDIO_FMT_DD_PLUS);
audioStr = "EAC3";
break;
case CZapitAudioChannel::LPCM:
audioStr = "LPCM";
break;
default:
printf("[zapit] unknown audio channel type 0x%x\n", audioChannelType);
break;
}
audioDecoder->SetStreamType(audioChannelType);
/* FIXME: bigger percent for AC3 only, what about AAC etc ? */
int newpercent = GetPidVolume(0, 0, audioChannelType == CZapitAudioChannel::AC3 || audioChannelType == CZapitAudioChannel::EAC3);
SetVolumePercent(newpercent);