From 74fd8f361f928820d9a29f56adfcc11273e01e05 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 8 Oct 2013 17:18:24 +0400 Subject: [PATCH] neutrino: add EAC3 audio support Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/2e6276def7a3c7e6eb969644833ea7218087a936 Author: [CST] Focus Date: 2013-10-08 (Tue, 08 Oct 2013) --- src/daemonc/remotecontrol.cpp | 7 ++++- src/driver/record.cpp | 26 ++++++++++++------- .../tuxboxapi/coolstream/controlapi.cpp | 4 +-- .../tuxboxapi/coolstream/neutrinoyparser.cpp | 4 +-- src/zapit/include/zapit/channel.h | 1 + src/zapit/include/zapit/client/zapitclient.h | 1 + src/zapit/src/scanpmt.cpp | 3 +++ src/zapit/src/zapit.cpp | 8 +++++- 8 files changed, 38 insertions(+), 16 deletions(-) diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index ed0a96ca4..8b27129bb 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -481,7 +481,8 @@ void CRemoteControl::processAPIDnames() pref_found = j; pref_idx = i; } - if(current_PIDs.APIDs[j].is_ac3 && g_settings.audio_DolbyDigital && (pref_ac3_found < 0)) { + if((current_PIDs.APIDs[j].is_ac3 || current_PIDs.APIDs[j].is_eac3) + && g_settings.audio_DolbyDigital && (pref_ac3_found < 0)) { pref_ac3_found = j; pref_ac3_idx = i; } @@ -519,6 +520,8 @@ void CRemoteControl::processAPIDnames() } else if (current_PIDs.APIDs[count].is_aac && !strstr(current_PIDs.APIDs[count].desc, " (AAC)")) strncat(current_PIDs.APIDs[count].desc, " (AAC)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[count].desc)-1); + else if (current_PIDs.APIDs[count].is_eac3 && !strstr(current_PIDs.APIDs[count].desc, " (EAC3)")) + strncat(current_PIDs.APIDs[count].desc, " (EAC3)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[count].desc)-1); } if ( has_unresolved_ctags ) @@ -544,6 +547,8 @@ void CRemoteControl::processAPIDnames() strncat(current_PIDs.APIDs[j].desc, " (AC3)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[j].desc)-1); else if (current_PIDs.APIDs[j].is_aac && !strstr(current_PIDs.APIDs[j].desc, " (AAC)")) strncat(current_PIDs.APIDs[j].desc, " (AAC)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[j].desc)-1); + else if (current_PIDs.APIDs[j].is_aac && !strstr(current_PIDs.APIDs[j].desc, " (EAC3)")) + strncat(current_PIDs.APIDs[j].desc, " (EAC3)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[j].desc)-1); } current_PIDs.APIDs[j].component_tag = -1; break; diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 8088e654d..6df68848e 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -321,7 +321,7 @@ bool CRecordInstance::Update() audio_pids.epgAudioPid = allpids.APIDs[i].pid; audio_pids.epgAudioPidName = allpids.APIDs[i].desc; - audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; + audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : allpids.APIDs[i].is_eac3 ? 7 : 0; audio_pids.selected = 0; recMovieInfo->audioPids.push_back(audio_pids); } @@ -354,11 +354,13 @@ void CRecordInstance::GetPids(CZapitChannel * channel) CZapitClient::responseGetAPIDs response; response.pid = channel->getAudioPid(i); strncpy(response.desc, channel->getAudioChannel(i)->description.c_str(), DESC_MAX_LEN - 1); - response.is_ac3 = response.is_aac = 0; + response.is_ac3 = response.is_aac = response.is_eac3 = 0; if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::AC3) { response.is_ac3 = 1; } else if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::AAC) { response.is_aac = 1; + } else if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3) { + response.is_eac3 = 1; } response.component_tag = channel->getAudioChannel(i)->componentTag; allpids.APIDs.push_back(response); @@ -382,6 +384,8 @@ void CRecordInstance::ProcessAPIDnames() strncat(allpids.APIDs[count].desc, " (AC3)", DESC_MAX_LEN - strlen(allpids.APIDs[count].desc) -1); else if (allpids.APIDs[count].is_aac && !strstr(allpids.APIDs[count].desc, " (AAC)")) strncat(allpids.APIDs[count].desc, " (AAC)", DESC_MAX_LEN - strlen(allpids.APIDs[count].desc) -1); + else if (allpids.APIDs[count].is_eac3 && !strstr(allpids.APIDs[count].desc, " (EAC3)")) + strncat(allpids.APIDs[count].desc, " (EAC3)", DESC_MAX_LEN - strlen(allpids.APIDs[count].desc) -1); } if(has_unresolved_ctags && (epgid != 0)) { @@ -396,6 +400,8 @@ void CRecordInstance::ProcessAPIDnames() strncat(allpids.APIDs[j].desc, " (AC3)", DESC_MAX_LEN - strlen(allpids.APIDs[j].desc)-1); else if (allpids.APIDs[j].is_aac && !strstr(allpids.APIDs[j].desc, " (AAC)")) strncat(allpids.APIDs[j].desc, " (AAC)", DESC_MAX_LEN - strlen(allpids.APIDs[j].desc)-1); + else if (allpids.APIDs[j].is_eac3 && !strstr(allpids.APIDs[j].desc, " (EAC3)")) + strncat(allpids.APIDs[j].desc, " (EAC3)", DESC_MAX_LEN - strlen(allpids.APIDs[j].desc)-1); } allpids.APIDs[j].component_tag = -1; break; @@ -455,7 +461,7 @@ void CRecordInstance::FilterPids(APIDList & apid_list) uint32_t apid_min=UINT_MAX; uint32_t apid_min_idx=0; for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) { + if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3 && !allpids.APIDs[i].is_eac3) { apid_min = allpids.APIDs[i].pid; apid_min_idx = i; } @@ -468,12 +474,12 @@ void CRecordInstance::FilterPids(APIDList & apid_list) if (apidmode & TIMERD_APIDS_ALT) { uint32_t apid_min=UINT_MAX; for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) { + if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3 && !allpids.APIDs[i].is_eac3) { apid_min = allpids.APIDs[i].pid; } } for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid != apid_min && !allpids.APIDs[i].is_ac3) { + if (allpids.APIDs[i].pid != apid_min && !allpids.APIDs[i].is_ac3 && !allpids.APIDs[i].is_eac3) { APIDDesc a = {allpids.APIDs[i].pid, i, false}; apid_list.push_back(a); } @@ -482,7 +488,7 @@ void CRecordInstance::FilterPids(APIDList & apid_list) if (apidmode & TIMERD_APIDS_AC3) { bool ac3_found=false; for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].is_ac3) { + if (allpids.APIDs[i].is_ac3 || allpids.APIDs[i].is_eac3) { APIDDesc a = {allpids.APIDs[i].pid, i, true}; apid_list.push_back(a); ac3_found=true; @@ -493,7 +499,7 @@ void CRecordInstance::FilterPids(APIDList & apid_list) uint32_t apid_min=UINT_MAX; uint32_t apid_min_idx=0; for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) { + if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3 && !allpids.APIDs[i].is_eac3) { apid_min = allpids.APIDs[i].pid; apid_min_idx = i; } @@ -509,7 +515,7 @@ void CRecordInstance::FilterPids(APIDList & apid_list) uint32_t apid_min=UINT_MAX; uint32_t apid_min_idx=0; for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) { + if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3 && !allpids.APIDs[i].is_eac3) { apid_min = allpids.APIDs[i].pid; apid_min_idx = i; } @@ -571,7 +577,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis if(allpids.APIDs[i].pid == it->apid) { audio_pids.epgAudioPid = allpids.APIDs[i].pid; audio_pids.epgAudioPidName = allpids.APIDs[i].desc; - audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; + audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : allpids.APIDs[i].is_eac3 ? 7 : 0; audio_pids.selected = (audio_pids.epgAudioPid == channel->getAudioPid()) ? 1 : 0; recMovieInfo->audioPids.push_back(audio_pids); } @@ -582,7 +588,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis int i = 0; audio_pids.epgAudioPid = allpids.APIDs[i].pid; audio_pids.epgAudioPidName = allpids.APIDs[i].desc; - audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; + audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : allpids.APIDs[i].is_eac3 ? 7 : 0; audio_pids.selected = 1; recMovieInfo->audioPids.push_back(audio_pids); } diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 39849582f..04c9b9474 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -1623,7 +1623,7 @@ void CControlAPI::SendAllCurrentVAPid(CyhookHandler *hh) { strncpy( pids.APIDs[j].desc, _getISO639Description( pids.APIDs[j].desc ),DESC_MAX_LEN ); } - hh->printf("%05u %s %s\n",pids.APIDs[j].pid,pids.APIDs[j].desc,pids.APIDs[j].is_ac3 ? " (AC3)": " "); + hh->printf("%05u %s %s\n",pids.APIDs[j].pid,pids.APIDs[j].desc,pids.APIDs[j].is_ac3 ? " (AC3)": pids.APIDs[j].desc,pids.APIDs[j].is_aac ? "(AAC)" : pids.APIDs[j].desc,pids.APIDs[j].is_eac3 ? "(EAC3)" : " "); } eit_not_ok=false; break; @@ -1640,7 +1640,7 @@ void CControlAPI::SendAllCurrentVAPid(CyhookHandler *hh) { strncpy( pids.APIDs[i].desc, _getISO639Description( pids.APIDs[i].desc ),DESC_MAX_LEN ); } - hh->printf("%05u %s %s\n",it->pid,pids.APIDs[i].desc,pids.APIDs[i].is_ac3 ? " (AC3)": " "); + hh->printf("%05u %s %s\n",it->pid,pids.APIDs[i].desc,pids.APIDs[i].is_ac3 ? " (AC3)": pids.APIDs[i].desc,pids.APIDs[i].is_aac ? "(AAC)" : pids.APIDs[i].desc,pids.APIDs[i].is_eac3 ? "(EAC3)" : " "); i++; } } diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index 85fcde1d1..0673b132b 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -600,7 +600,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *, { strcpy( pids.APIDs[j].desc, _getISO639Description( pids.APIDs[j].desc ) ); } - yresult += string_printf("\r\n",idx_as_id ? j : pids.APIDs[j].pid,std::string(pids.APIDs[j].desc).c_str(),pids.APIDs[j].is_ac3 ? " (AC3)": " "); + yresult += string_printf("\r\n",idx_as_id ? j : pids.APIDs[j].pid,std::string(pids.APIDs[j].desc).c_str(),pids.APIDs[j].is_ac3 ? " (AC3)": pids.APIDs[j].is_aac ? "(AAC)" : pids.APIDs[j].is_eac3 ? "(EAC3)" : " "); } eit_not_ok=false; break; @@ -617,7 +617,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *, { strcpy( pids.APIDs[i].desc, _getISO639Description( pids.APIDs[i].desc ) ); } - yresult += string_printf("\r\n",idx_as_id ? i : it->pid,pids.APIDs[i].desc,pids.APIDs[i].is_ac3 ? " (AC3)": " "); + yresult += string_printf("\r\n",idx_as_id ? i : it->pid,pids.APIDs[i].desc,pids.APIDs[i].is_ac3 ? " (AC3)": pids.APIDs[i].is_aac ? "(AAC)" : pids.APIDs[i].is_eac3 ? "(EAC3)" : " "); i++; } } diff --git a/src/zapit/include/zapit/channel.h b/src/zapit/include/zapit/channel.h index 4aa756340..185d3ea68 100644 --- a/src/zapit/include/zapit/channel.h +++ b/src/zapit/include/zapit/channel.h @@ -101,6 +101,7 @@ class CZapitAudioChannel AAC, AACPLUS, //? DTS, + EAC3, UNKNOWN }; ZapitAudioChannelType audioChannelType; diff --git a/src/zapit/include/zapit/client/zapitclient.h b/src/zapit/include/zapit/client/zapitclient.h index b71568f83..4f29331c8 100644 --- a/src/zapit/include/zapit/client/zapitclient.h +++ b/src/zapit/include/zapit/client/zapitclient.h @@ -184,6 +184,7 @@ class CZapitClient:public CBasicClient char desc[DESC_MAX_LEN]; int is_ac3; int is_aac; + int is_eac3; int component_tag; }; diff --git a/src/zapit/src/scanpmt.cpp b/src/zapit/src/scanpmt.cpp index 9dda97ceb..b2e9b4789 100644 --- a/src/zapit/src/scanpmt.cpp +++ b/src/zapit/src/scanpmt.cpp @@ -221,6 +221,9 @@ bool CPmt::ParseEsInfo(ElementaryStreamInfo *esinfo, CZapitChannel * const chann case AC3_DESCRIPTOR: audio_type = CZapitAudioChannel::AC3; break; + case ENHANCED_AC3_DESCRIPTOR: + audio_type = CZapitAudioChannel::EAC3; + break; case DTS_DESCRIPTOR: audio_type = CZapitAudioChannel::DTS; break; diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 6dcc2cc43..ea78d3746 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -826,6 +826,10 @@ void CZapit::SetAudioStreamType(CZapitAudioChannel::ZapitAudioChannelType audioC audioStr = "DTS"; audioDecoder->SetStreamType(AUDIO_FMT_DTS); break; + case CZapitAudioChannel::EAC3: + audioStr = "DD-PLUS"; + audioDecoder->SetStreamType(AUDIO_FMT_DD_PLUS); + break; default: printf("[zapit] unknown audio channel type 0x%x\n", audioChannelType); break; @@ -1842,11 +1846,13 @@ void CZapit::sendAPIDs(int connfd) CZapitClient::responseGetAPIDs response; response.pid = current_channel->getAudioPid(i); strncpy(response.desc, current_channel->getAudioChannel(i)->description.c_str(), DESC_MAX_LEN-1); - response.is_ac3 = response.is_aac = 0; + response.is_ac3 = response.is_aac = response.is_eac3 = 0; if (current_channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::AC3) { response.is_ac3 = 1; } else if (current_channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::AAC) { response.is_aac = 1; + } else if (current_channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3) { + response.is_eac3 = 1; } response.component_tag = current_channel->getAudioChannel(i)->componentTag;