aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-01-03 11:23:46 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-01-03 11:23:46 +0000
commit089df6a2a17ec560a9c525857b4bbe43442b5ca8 (patch)
treee1f33b220198561d695e33caa912050d510c9461 /lib
parent61ea204d226d23041b40248f3b2336fbb2f53b77 (diff)
downloadenigma2-089df6a2a17ec560a9c525857b4bbe43442b5ca8.tar.gz
enigma2-089df6a2a17ec560a9c525857b4bbe43442b5ca8.zip
store and use previous selected audio pid
Diffstat (limited to 'lib')
-rw-r--r--lib/dvb/db.cpp6
-rw-r--r--lib/dvb/pmt.cpp30
-rw-r--r--lib/service/servicedvb.cpp29
3 files changed, 60 insertions, 5 deletions
diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp
index 65b42def..3920053d 100644
--- a/lib/dvb/db.cpp
+++ b/lib/dvb/db.cpp
@@ -220,7 +220,10 @@ int eDVBService::getCachePID(cacheID id)
void eDVBService::setCachePID(cacheID id, int pid)
{
- m_cache[id] = pid;
+ if (pid == -1)
+ m_cache.erase(id);
+ else
+ m_cache[id] = pid;
}
DEFINE_REF(eDVBDB);
@@ -357,7 +360,6 @@ void eDVBDB::load()
fgets(line, 256, f);
if (strlen(line))
line[strlen(line)-1]=0;
-
std::string str=line;
if (str[1]!=':') // old ... (only service_provider)
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp
index 6b2c835c..a4e10e16 100644
--- a/lib/dvb/pmt.cpp
+++ b/lib/dvb/pmt.cpp
@@ -129,6 +129,15 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
if (!m_PMT.getCurrent(ptr))
{
+ int cached_apid_ac3 = -1;
+ int cached_apid_mpeg = -1;
+ int cached_vpid = -1;
+ if ( m_service && !m_service->cacheEmpty() )
+ {
+ cached_vpid = m_service->getCachePID(eDVBService::cVPID);
+ cached_apid_mpeg = m_service->getCachePID(eDVBService::cAC3PID);
+ cached_apid_ac3 = m_service->getCachePID(eDVBService::cAPID);
+ }
eDVBTableSpec table_spec;
ptr->getSpec(table_spec);
program.pmtPid = table_spec.pid < 0x1fff ? table_spec.pid : -1;
@@ -201,9 +210,26 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
break;
}
if (isaudio)
- program.audioStreams.push_back(audio);
+ {
+ if ( !program.audioStreams.empty() &&
+ ( audio.pid == cached_apid_ac3 || audio.pid == cached_apid_mpeg) )
+ {
+ program.audioStreams.push_back(program.audioStreams[0]);
+ program.audioStreams[0] = audio;
+ }
+ else
+ program.audioStreams.push_back(audio);
+ }
else if (isvideo)
- program.videoStreams.push_back(video);
+ {
+ if ( !program.videoStreams.empty() && video.pid == cached_vpid )
+ {
+ program.videoStreams.push_back(program.videoStreams[0]);
+ program.videoStreams[0] = video;
+ }
+ else
+ program.videoStreams.push_back(video);
+ }
else
continue;
if ( cadescriptors > 0 )
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index cad2ea08..9cba0aaf 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -8,6 +8,7 @@
#include <lib/dvb/dvb.h>
#include <lib/dvb/db.h>
+#include <lib/dvb/decoder.h>
#include <lib/service/servicedvbrecord.h>
#include <lib/dvb/metaparser.h>
@@ -613,8 +614,17 @@ void eDVBServicePlay::serviceEvent(int event)
/* don't worry about non-existing services, nor pvr services */
if (m_dvb_service && !m_is_pvr)
{
+ if (apidtype == eDVBAudio::aMPEG)
+ {
+ m_dvb_service->setCachePID(eDVBService::cAPID, apid);
+ m_dvb_service->setCachePID(eDVBService::cAC3PID, -1);
+ }
+ else
+ {
+ m_dvb_service->setCachePID(eDVBService::cAPID, -1);
+ m_dvb_service->setCachePID(eDVBService::cAC3PID, apid);
+ }
m_dvb_service->setCachePID(eDVBService::cVPID, vpid);
- m_dvb_service->setCachePID(eDVBService::cAPID, apid);
m_dvb_service->setCachePID(eDVBService::cPCRPID, pcrpid);
}
}
@@ -979,6 +989,23 @@ int eDVBServicePlay::selectAudioStream(int i)
if (m_decoder->setAudioPID(program.audioStreams[i].pid, program.audioStreams[i].type))
return -4;
+ if (m_dvb_service && !m_is_pvr)
+ {
+ if (m_dvb_service && !m_is_pvr)
+ {
+ if (program.audioStreams[i].type == eDVBAudio::aMPEG)
+ {
+ m_dvb_service->setCachePID(eDVBService::cAPID, program.audioStreams[i].pid);
+ m_dvb_service->setCachePID(eDVBService::cAC3PID, -1);
+ }
+ else
+ {
+ m_dvb_service->setCachePID(eDVBService::cAPID, -1);
+ m_dvb_service->setCachePID(eDVBService::cAC3PID, program.audioStreams[i].pid);
+ }
+ }
+ }
+
m_current_audio_stream = i;
return 0;