X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/be40133df4db68185931042f43995cf27da480be..5eb41508927a7f48d09d52e158e136fa07252dac:/lib/service/servicedvb.cpp diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 17f841b5..4141236a 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -31,8 +31,6 @@ #error no byte order defined! #endif -#define TSPATH "/media/hdd" - class eStaticServiceDVBInformation: public iStaticServiceInformation { DECLARE_REF(eStaticServiceDVBInformation); @@ -174,17 +172,14 @@ void PutSatelliteDataToDict(ePyObject &dict, eDVBFrontendParametersSatellite &fe case eDVBFrontendParametersSatellite::RollOff::alpha_0_20: tmp="0.20"; break; } PutToDict(dict, "roll off", tmp); - if (feparm.modulation == eDVBFrontendParametersSatellite::Modulation::M8PSK) + switch(feparm.pilot) { - switch(feparm.pilot) - { - case eDVBFrontendParametersSatellite::Pilot::On: tmp="ON"; break; - case eDVBFrontendParametersSatellite::Pilot::Off: tmp="OFF"; break; - default: - case eDVBFrontendParametersSatellite::Pilot::Unknown: tmp="AUTO"; break; - } - PutToDict(dict, "pilot", tmp); + case eDVBFrontendParametersSatellite::Pilot::On: tmp="ON"; break; + case eDVBFrontendParametersSatellite::Pilot::Off: tmp="OFF"; break; + default: + case eDVBFrontendParametersSatellite::Pilot::Unknown: tmp="AUTO"; break; } + PutToDict(dict, "pilot", tmp); tmp="DVB-S2"; break; } @@ -412,7 +407,7 @@ RESULT eStaticServiceDVBBouquetInformation::getName(const eServiceReference &ref return -1; } -int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) +int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate) { if (ref.flags & eServiceReference::isGroup) { @@ -453,7 +448,7 @@ int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref { 2, 1, 3 } // -T -S -C }; ((const eServiceReferenceDVB&)*it).getChannelID(chid); - int tmp=res->canAllocateChannel(chid, chid_ignore); + int tmp=res->canAllocateChannel(chid, chid_ignore, simulate); switch(tmp) { case 0: @@ -1065,7 +1060,9 @@ eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref, eDVBService *serv m_tune_state = -1; - CONNECT(m_subtitle_sync_timer.timeout, eDVBServicePlay::checkSubtitleTiming); + m_subtitle_sync_timer = eTimer::create(eApp); + + CONNECT(m_subtitle_sync_timer->timeout, eDVBServicePlay::checkSubtitleTiming); } eDVBServicePlay::~eDVBServicePlay() @@ -1495,9 +1492,16 @@ RESULT eDVBServicePlay::timeshift(ePtr &ptr) { if (!m_timeshift_enabled) { - /* we need enough diskspace */ + /* query config path */ + std::string tspath; + if(ePythonConfigQuery::getConfigValue("config.usage.timeshift_path", tspath) == -1){ + eDebug("could not query ts path from config"); + return -4; + } + tspath.append("/"); + /* we need enough diskspace */ struct statfs fs; - if (statfs(TSPATH "/.", &fs) < 0) + if (statfs(tspath.c_str(), &fs) < 0) { eDebug("statfs failed!"); return -2; @@ -1569,46 +1573,67 @@ RESULT eDVBServicePlay::getEvent(ePtr &evt, int nownext) return m_event_handler.getEvent(evt, nownext); } +static int readMpegProc(char *str, int decoder) +{ + int val = -1; + char tmp[64]; + sprintf(tmp, "/proc/stb/vmpeg/%d/%s", decoder, str); + FILE *f = fopen(tmp, "r"); + if (f) + { + fscanf(f, "%x", &val); + fclose(f); + } + return val; +} + int eDVBServicePlay::getInfo(int w) { eDVBServicePMTHandler::program program; - + if (w == sCAIDs) return resIsPyObject; eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler; - + int no_program_info = 0; - + if (h.getProgramInfo(program)) no_program_info = 1; - + switch (w) { #if HAVE_DVB_API_VERSION >= 3 case sVideoHeight: - if (m_videoEventData.type != iTSMPEGDecoder::videoEvent::eventUnknown) + if (m_videoEventData.type == iTSMPEGDecoder::videoEvent::eventSizeChanged) return m_videoEventData.height; - return -1; + else + return readMpegProc("yres", !m_is_primary); case sVideoWidth: - if (m_videoEventData.type != iTSMPEGDecoder::videoEvent::eventUnknown) + if (m_videoEventData.type == iTSMPEGDecoder::videoEvent::eventSizeChanged) return m_videoEventData.width; - return -1; + else + return readMpegProc("xres", !m_is_primary); case sFrameRate: - if (m_videoEventData.type != iTSMPEGDecoder::videoEvent::eventUnknown) + if (m_videoEventData.type == iTSMPEGDecoder::videoEvent::eventFrameRateChanged) return m_videoEventData.framerate; - return -1; + else + return readMpegProc("framerate", !m_is_primary); case sProgressive: - if (m_videoEventData.type != iTSMPEGDecoder::videoEvent::eventUnknown) + if (m_videoEventData.type == iTSMPEGDecoder::videoEvent::eventProgressiveChanged) return m_videoEventData.progressive; - return -1; + return readMpegProc("progressive", !m_is_primary); #else #warning "FIXMEE implement sFrameRate, sProgressive, sVideoHeight, sVideoWidth for old DVB API" #endif case sAspect: + { + int val; #if HAVE_DVB_API_VERSION >= 3 - if (m_videoEventData.type != iTSMPEGDecoder::videoEvent::eventUnknown) + if (m_videoEventData.type == iTSMPEGDecoder::videoEvent::eventSizeChanged) return m_videoEventData.aspect == VIDEO_FORMAT_4_3 ? 1 : 3; + else if ((val=readMpegProc("aspect", !m_is_primary)) != -1) + return val; else #else #warning "FIXMEE implement sAspect for old DVB API" @@ -1653,6 +1678,7 @@ int eDVBServicePlay::getInfo(int w) } } return -1; + } case sIsCrypted: if (no_program_info) return -1; return program.isCrypted(); case sVideoPID: if (no_program_info) return -1; if (program.videoStreams.empty()) return -1; return program.videoStreams[0].pid; case sVideoType: if (no_program_info) return -1; if (program.videoStreams.empty()) return -1; return program.videoStreams[0].type; @@ -2093,12 +2119,23 @@ RESULT eDVBServicePlay::startTimeshift() if (!m_record) return -3; - char templ[]=TSPATH "/timeshift.XXXXXX"; + std::string tspath; + if(ePythonConfigQuery::getConfigValue("config.usage.timeshift_path", tspath) == -1){ + eDebug("could not query ts path"); + return -5; + } + tspath.append("/timeshift.XXXXXX"); + char* templ; + templ = new char[tspath.length() + 1]; + strcpy(templ, tspath.c_str()); + m_timeshift_fd = mkstemp(templ); - m_timeshift_file = templ; - + m_timeshift_file = std::string(templ); + eDebug("recording to %s", templ); - + + delete [] templ; + if (m_timeshift_fd < 0) { m_record = 0; @@ -2904,7 +2941,7 @@ void eDVBServicePlay::checkSubtitleTiming() } else { eDebug("start subtitle delay %d", diff / 90); - m_subtitle_sync_timer.start(diff / 90, 1); + m_subtitle_sync_timer->start(diff / 90, 1); break; } } @@ -2961,21 +2998,19 @@ void eDVBServicePlay::setPCMDelay(int delay) void eDVBServicePlay::video_event(struct iTSMPEGDecoder::videoEvent event) { + memcpy(&m_videoEventData, &event, sizeof(event)); switch(event.type) { case iTSMPEGDecoder::videoEvent::eventSizeChanged: - m_videoEventData.aspect = event.aspect; - m_videoEventData.height = event.height; - m_videoEventData.width = event.width; m_event((iPlayableService*)this, evVideoSizeChanged); break; case iTSMPEGDecoder::videoEvent::eventFrameRateChanged: - m_videoEventData.framerate = event.framerate; m_event((iPlayableService*)this, evVideoFramerateChanged); break; case iTSMPEGDecoder::videoEvent::eventProgressiveChanged: - m_videoEventData.progressive = event.progressive; m_event((iPlayableService*)this, evVideoProgressiveChanged); break; + default: + break; } }