aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb/pmt.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2007-08-25 01:47:40 +0000
committerFelix Domke <tmbinc@elitedvb.net>2007-08-25 01:47:40 +0000
commitdd12594a3c0fabd2e09a1bdd79db333bd8210829 (patch)
tree06519c6d9ad3a2075a9d37e76bf94f1aa57a07ae /lib/dvb/pmt.cpp
parent309f38ffddbc90495d0a1a2dd6d5042b633785b4 (diff)
downloadenigma2-dd12594a3c0fabd2e09a1bdd79db333bd8210829.tar.gz
enigma2-dd12594a3c0fabd2e09a1bdd79db333bd8210829.zip
take defaultac3 back into account when choosing defaultAudioStream. defaultac3 will override the old default if it's not an AC3 track with the first AC3 track.
Diffstat (limited to 'lib/dvb/pmt.cpp')
-rw-r--r--lib/dvb/pmt.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp
index c295df31..e940e58f 100644
--- a/lib/dvb/pmt.cpp
+++ b/lib/dvb/pmt.cpp
@@ -14,6 +14,7 @@
#include <dvbsi++/stream_identifier_descriptor.h>
#include <dvbsi++/subtitling_descriptor.h>
#include <dvbsi++/teletext_descriptor.h>
+#include <lib/base/nconfig.h> // access to python config
eDVBServicePMTHandler::eDVBServicePMTHandler()
:m_ca_servicePtr(0), m_dvb_scan(0), m_decode_demux_num(0xFF)
@@ -174,6 +175,8 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
program.pcrPid = -1;
program.pmtPid = -1;
program.textPid = -1;
+
+ int first_ac3 = -1;
program.defaultAudioStream = 0;
if ( m_service && !m_service->cacheEmpty() )
@@ -317,9 +320,15 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
if (isaudio)
{
audio.pid = (*es)->getPid();
- if ( !program.audioStreams.empty() &&
- ( audio.pid == cached_apid_ac3 || audio.pid == cached_apid_mpeg) )
+
+ /* if we find the cached pids, this will be our default stream */
+ if (audio.pid == cached_apid_ac3 || audio.pid == cached_apid_mpeg)
program.defaultAudioStream = program.audioStreams.size();
+
+ /* also, we need to know the first non-mpeg (i.e. "ac3"/dts/...) stream */
+ if ((audio.type != audioStream::atMPEG) && ((first_ac3 == -1) || (audio.pid == cached_apid_ac3)))
+ first_ac3 = program.audioStreams.size();
+
program.audioStreams.push_back(audio);
}
else if (isvideo)
@@ -347,6 +356,21 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
}
}
ret = 0;
+
+
+ /* finally some fixup: if our default audio stream is an MPEG audio stream,
+ and we have 'defaultac3' set, use the first available ac3 stream instead.
+ (note: if an ac3 audio stream was selected before, this will be also stored
+ in 'fisrt_ac3', so we don't need to worry. */
+ bool defaultac3 = false;
+ std::string default_ac3;
+
+ if (!ePythonConfigQuery::getConfigValue("config.av.defaultac3", default_ac3))
+ defaultac3 = default_ac3 == "True";
+
+ if (defaultac3 && (first_ac3 != -1))
+ program.defaultAudioStream = first_ac3;
+
m_cached_program = program;
m_have_cached_program = true;
}