From 3d90ab1f54d07c4a25811b3819befacefd0a774d Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Sun, 17 Feb 2008 23:16:49 +0000 Subject: [PATCH 1/1] fix return codes in streaming --- lib/python/Components/Converter/Streaming.py | 27 ++++++++++++-------- lib/service/iservice.h | 4 ++- lib/service/servicedvbrecord.cpp | 8 ++++++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/lib/python/Components/Converter/Streaming.py b/lib/python/Components/Converter/Streaming.py index ece17490..f12ebd99 100644 --- a/lib/python/Components/Converter/Streaming.py +++ b/lib/python/Components/Converter/Streaming.py @@ -1,6 +1,13 @@ from Converter import Converter from Components.Element import cached +# the protocol works as the following: + +# lines starting with '-' are fatal errors (no recovery possible), +# lines starting with '=' are progress notices, +# lines starting with '+' are PIDs to record: +# "+d:[p:t[,p:t...]]" with d=demux nr, p: pid, t: type + class Streaming(Converter): def __init__(self, type): Converter.__init__(self, type) @@ -9,21 +16,21 @@ class Streaming(Converter): def getText(self): service = self.source.service if service is None: - return "-NO SERVICE" + return "-NO SERVICE\n" streaming = service.stream() s = streaming and streaming.getStreamingData() - if streaming is None: + if s is None: err = service.getError() - return "-1SERVICE ERROR:%d" % err - - r = streaming.getStreamingData() - if r is None: - return "-NO STREAM" - - demux = r["demux"] - pids = ','.join(["%x:%s" % (x[0], x[1]) for x in r["pids"]]) + from enigma import iRecordableService + if err: + return "-SERVICE ERROR:%d\n" % err + else: + return "=NO STREAM\n" + + demux = s["demux"] + pids = ','.join(["%x:%s" % (x[0], x[1]) for x in s["pids"]]) return "+%d:%s\n" % (demux, pids) diff --git a/lib/service/iservice.h b/lib/service/iservice.h index bfdca1ba..f367f6ad 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -782,7 +782,9 @@ public: errNoDemuxAvailable=-2, errNoTsRecorderAvailable=-3, errDiskFull=-4, - errTuneFailed=-255 + errTuneFailed=-255, + errMisconfiguration = -256, + errNoResources = -257, }; }; diff --git a/lib/service/servicedvbrecord.cpp b/lib/service/servicedvbrecord.cpp index b34dad10..86461d05 100644 --- a/lib/service/servicedvbrecord.cpp +++ b/lib/service/servicedvbrecord.cpp @@ -45,6 +45,14 @@ void eDVBServiceRecord::serviceEvent(int event) m_event((iRecordableService*)this, evNewProgramInfo); break; } + case eDVBServicePMTHandler::eventMisconfiguration: + m_error = errMisconfiguration; + m_event((iRecordableService*)this, evTuneFailed); + break; + case eDVBServicePMTHandler::eventNoResources: + m_error = errNoResources; + m_event((iRecordableService*)this, evTuneFailed); + break; } } -- 2.30.2