int cDynamicDevice::GetUdevAttributesForAttach(const char *DevPath, int &CardIndex, int &AttachDelay, bool &AttachDelayPreopen) { CardIndex = -1; AttachDelay = 0; AttachDelayPreopen = false; if (DevPath == NULL) return -1; cUdevDevice *dev = cUdev::GetDeviceFromDevName(DevPath); if (dev == NULL) return -1; int intVal; const char *val = dev->GetPropertyValue("dynamite_cardindex"); if (val) { isyslog("dynamite: udev cardindex is %s", val); intVal = -1; if (val && (sscanf(val, "%d", &intVal) == 1) && (intVal >= 0) && (intVal <= MAXDEVICES)) CardIndex = intVal; } val = dev->GetPropertyValue("dynamite_attach_delay"); if (val) { isyslog("dynamite: udev attach_delay is %s", val); intVal = 0; if (val && (sscanf(val, "%d", &intVal) == 1) && (intVal > 0)) AttachDelay = intVal; } val = dev->GetPropertyValue("dynamite_attach_delay_preopen"); if (val) { isyslog("dynamite: udev attach_delay_preopen is %s", val); if ((strcmp(val, "1") == 0) || (strcasecmp(val, "y") == 0) || (strcasecmp(val, "yes") == 0)) AttachDelayPreopen = true; } delete dev; return 0; }
void cDvbTuner::Action(void) { cTimeMs Timer; bool LostLock = false; fe_status_t Status = (fe_status_t)0; while (Running()) { fe_status_t NewStatus; if (GetFrontendStatus(NewStatus, 10)) Status = NewStatus; cMutexLock MutexLock(&mutex); switch (tunerStatus) { case tsIdle: break; case tsSet: tunerStatus = SetFrontend() ? tsTuned : tsIdle; Timer.Set(tuneTimeout); continue; case tsTuned: if (Timer.TimedOut()) { tunerStatus = tsSet; diseqcCommands = NULL; if (time(NULL) - lastTimeoutReport > 60) { // let's not get too many of these isyslog("frontend %d timed out while tuning to channel %d, tp %d", cardIndex, channel.Number(), channel.Transponder()); lastTimeoutReport = time(NULL); } continue; } case tsLocked: if (Status & FE_REINIT) { tunerStatus = tsSet; diseqcCommands = NULL; isyslog("frontend %d was reinitialized", cardIndex); lastTimeoutReport = 0; continue; } else if (Status & FE_HAS_LOCK) { if (LostLock) { isyslog("frontend %d regained lock on channel %d, tp %d", cardIndex, channel.Number(), channel.Transponder()); LostLock = false; } tunerStatus = tsLocked; locked.Broadcast(); lastTimeoutReport = 0; } else if (tunerStatus == tsLocked) { LostLock = true; isyslog("frontend %d lost lock on channel %d, tp %d", cardIndex, channel.Number(), channel.Transponder()); tunerStatus = tsTuned; Timer.Set(lockTimeout); lastTimeoutReport = 0; continue; } } if (ciHandler) ciHandler->Process(); if (tunerStatus != tsTuned) newSet.TimedWait(mutex, 1000); } }
void cQuickShutdownLive::Action(void) { #if VDRVERSNUM < 10300 isyslog("VDR: QuickShutdown Live thread started (pid = %d)", getpid()); #endif // give time for change in player before switching OFF the HDE output // else at times the Video frame remain on Screen cCondWait::SleepMs(250); // show any images HERE before blanking the screen // eg. Screen informing the user, it is "Quick-Shutdown" /*switch off hdplayer */ ToggleVideoOutput(0); // Call external quickshutdown to prepare frontpanel etc. SystemExec("quickshutdown.sh start"); m_Active = true; while (m_Active) { //DeviceStillPicture(suspend_mpg, sizeof(suspend_mpg)); // this player does nothing, so sleep cCondWait::SleepMs(250); } #if VDRVERSNUM < 10300 isyslog("VDR: QuickShutdown Live thread stopped"); #endif }
void cDynamicDevice::AutoIdle(void) { if (idleTimeoutMinutes <= 0) return; cMutexLock lock(&arrayMutex); time_t now = time(NULL); bool wokeupSomeDevice = false; int seconds = 0; for (int i = 0; i < numDynamicDevices; i++) { if ((dynamicdevice[i]->devpath != NULL) && !dynamicdevice[i]->disableAutoIdle) { if (dynamicdevice[i]->IsIdle()) { seconds = now - dynamicdevice[i]->idleSince; if ((dynamicdevice[i]->idleSince > 0) && (seconds >= (idleWakeupHours * 3600))) { isyslog("dynamite: device %s idle for %d hours, waking up", dynamicdevice[i]->GetDevPath(), seconds / 3600); cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcService, *cString::sprintf("dynamite-SetNotIdle-v0.1 %s", dynamicdevice[i]->GetDevPath())); wokeupSomeDevice = true; } } else { seconds = now - dynamicdevice[i]->lastCloseDvr; if ((dynamicdevice[i]->lastCloseDvr > 0) && (seconds >= (idleTimeoutMinutes * 60))) { if (dynamicdevice[i]->lastCloseDvr > 0) isyslog("dynamite: device %s unused for %d minutes, set to idle", dynamicdevice[i]->GetDevPath(), seconds / 60); else isyslog("dynamite: device %s never used , set to idle", dynamicdevice[i]->GetDevPath()); cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcService, *cString::sprintf("dynamite-SetIdle-v0.1 %s", dynamicdevice[i]->GetDevPath())); } } } } if (wokeupSomeDevice) { // initiate epg-scan? } }
eKeys cSkins::Message(eMessageType Type, const char *s, int Seconds) { switch (Type) { case mtInfo: isyslog("info: %s", s); break; case mtWarning: isyslog("warning: %s", s); break; case mtError: esyslog("ERROR: %s", s); break; default: ; } if (!Current()) return kNone; if (!cSkinDisplay::Current() && !displayMessage) displayMessage = Current()->DisplayMessage(); cSkinDisplay::Current()->SetMessage(Type, s); cSkinDisplay::Current()->Flush(); cStatus::MsgOsdStatusMessage(s); eKeys k = kNone; if (Type != mtStatus) { k = Interface->Wait(Seconds); if (displayMessage) { delete displayMessage; displayMessage = NULL; cStatus::MsgOsdClear(); } else { cSkinDisplay::Current()->SetMessage(Type, NULL); cStatus::MsgOsdStatusMessage(NULL); } } else if (!s && displayMessage) { delete displayMessage; displayMessage = NULL; cStatus::MsgOsdClear(); } return k; }
cTDT::cTDT(const u_char *Data) :SI::TDT(Data, false) { CheckParse(); time_t sattim = getTime(); time_t loctim = time(NULL); int diff = abs(sattim - loctim); if (diff > 2) { mutex.Lock(); if (abs(diff - lastDiff) < 3) { isyslog("System Time = %s (%ld)", *TimeToString(loctim), loctim); isyslog("Local Time = %s (%ld)", *TimeToString(sattim), sattim); if (stime(&sattim) < 0){ char __errorstr[256]; strerror_r(errno,__errorstr,256); __errorstr[255]=0; esyslog("ERROR while setting system time: %s",__errorstr); } } lastDiff = diff; mutex.Unlock(); } }
virtual bool Probe(int Adapter, int Frontend) { if (firstProbe) { firstProbe = false; isyslog("dynamite: preparing %d dynamic device slots for dvb devices", MAXDVBDEVICES); while (cDevice::NumDevices() < MAXDVBDEVICES) new cDynamicDevice; } cString devpath = cString::sprintf("/dev/dvb/adapter%d/frontend%d", Adapter, Frontend); int freeIndex = -1; if (cDynamicDevice::IndexOf(*devpath, freeIndex, -1) >= 0) // already attached - should not happen return true; if (freeIndex < 0) { if ((cDevice::NumDevices() >= MAXDEVICES) || (cDynamicDevice::NumDynamicDevices() >= MAXDEVICES)) { esyslog("dynamite: too many dvb-devices, vdr supports only %d devices - increase MAXDEVICES and recompile vdr", MAXDEVICES); return false; } new cDynamicDevice; } isyslog("dynamite: grab dvb device %d/%d", Adapter, Frontend); //cDynamicDevice::AttachDevice(*devpath); // or better attach later when all plugins are started? cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcAttach, *devpath); return true; // grab all dvbdevices }
/** \brief Load an individual freesat data file * * \param tableid - Table id that should be loaded * \param filename - Filename to load */ static void load_file(int tableid, char *filename) { char buf[1024]; char *from, *to, *binary; FILE *fp; tableid--; if ( ( fp = fopen(filename,"r") ) != NULL ) { isyslog("Loading table %d Filename <%s>",tableid + 1, filename); while ( fgets(buf,sizeof(buf),fp) != NULL ) { from = binary = to = NULL; int elems = sscanf(buf,"%a[^:]:%a[^:]:%a[^:]:", &from, &binary, &to); if ( elems == 3 ) { int bin_len = strlen(binary); int from_char = resolve_char(from); char to_char = resolve_char(to); unsigned long bin = decode_binary(binary); int i = table_size[tableid][from_char]++; tables[tableid][from_char] = (struct hufftab *)realloc(tables[tableid][from_char], (i+1) * sizeof(tables[tableid][from_char][0])); tables[tableid][from_char][i].value = bin; tables[tableid][from_char][i].next = to_char; tables[tableid][from_char][i].bits = bin_len; free(from); free(to); free(binary); } } } else { isyslog("Cannot load <%s> for table %d",filename,tableid + 1); } }
bool cInterface::Confirm(const char *s, int Seconds, bool WaitForTimeout) { isyslog("confirm: %s", s); eKeys k = Skins.Message(mtWarning, s, Seconds); bool result = WaitForTimeout ? k == kNone : k == kOk; isyslog("%sconfirmed", result ? "" : "not "); return result; }
void cDBusMessagePlugin::SVDRPCommand(void) { const char *pluginName = dbus_message_get_path(_msg); const char *command = NULL; const char *option = NULL; DBusMessageIter args; if (!dbus_message_iter_init(_msg, &args)) esyslog("dbus2vdr: %s.SVDRPCommand: message misses an argument for the command", DBUS_VDR_PLUGIN_INTERFACE); else { int rc = cDBusHelper::GetNextArg(args, DBUS_TYPE_STRING, &command); if (rc < 0) esyslog("dbus2vdr: %s.SVDRPCommand: 'command' argument is not a string", DBUS_VDR_PLUGIN_INTERFACE); else if (rc == 0) isyslog("dbus2vdr: %s.SVDRPCommand: command '%s' has no option", DBUS_VDR_PLUGIN_INTERFACE, command); else if (cDBusHelper::GetNextArg(args, DBUS_TYPE_STRING, &option) < 0) esyslog("dbus2vdr: %s.SVDRPCommand: 'option' argument is not string", DBUS_VDR_PLUGIN_INTERFACE); } dbus_int32_t replyCode = 500; cString replyMessage; if ((pluginName != NULL) && (command != NULL)) { if ((strlen(pluginName) > 9) && (strncmp(pluginName, "/Plugins/", 9) == 0)) { cPlugin *plugin = cPluginManager::GetPlugin(pluginName + 9); if (plugin != NULL) { if (option == NULL) option = ""; isyslog("dbus2vdr: invoking %s.SVDRPCommand(\"%s\", \"%s\")", plugin->Name(), command, option); replyCode = 900; cString s = plugin->SVDRPCommand(command, option, replyCode); if (*s) { replyMessage = s; } else { replyCode = 500; replyMessage = cString::sprintf("Command unrecognized: \"%s\"", command); } } } } DBusMessage *reply = dbus_message_new_method_return(_msg); dbus_message_iter_init_append(reply, &args); if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &replyCode)) esyslog("dbus2vdr: %s.SVDRPCommand: out of memory while appending the reply-code", DBUS_VDR_PLUGIN_INTERFACE); if (*replyMessage == NULL) replyMessage = ""; const char *message = *replyMessage; if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &message)) esyslog("dbus2vdr: %s.SVDRPCommand: out of memory while appending the reply-message", DBUS_VDR_PLUGIN_INTERFACE); dbus_uint32_t serial = 0; if (!dbus_connection_send(_conn, reply, &serial)) esyslog("dbus2vdr: %s.SVDRPCommand: out of memory while sending the reply", DBUS_VDR_PLUGIN_INTERFACE); dbus_message_unref(reply); }
cConnection::~cConnection() { isyslog("VNSI: cConnection::~cConnection()"); StopChannelStreaming(); m_socket.close(); // force closing connection isyslog("VNSI: stopping cConnection thread ..."); Cancel(10); isyslog("VNSI: done"); }
void cBufferRecorder::FillInitialData(uchar *Data, int Size) { if(liveBufferIndex) { int64_t search_pts = Data ? TsGetPts(Data, Size) : -1; int maxWait = WAIT_WRITING_COUNT; uchar buffer[MAXFRAMESIZE]; int Length; bool Independent; bool found = false; while(Running() && (!Data || (Size >= TS_SIZE))) { cUnbufferedFile *file = ((cLiveIndex *)liveBufferIndex)->GetNextBuffer(Length, Independent); if(!file) { if(((cLiveIndex *)liveBufferIndex)->WritingBufferCanceled()) { isyslog("Writing buffer canceled by user"); if(fileSize) TsSetTeiOnBrokenPackets(Data, Size); ((cLiveIndex *)liveBufferIndex)->SetBufferStart(0); liveBufferIndex = NULL; return; } // if if(!Data || !Size) return; if(!maxWait--) break; usleep(WAIT_WRITING_SLEEP); continue; } // if if (!NextFile()) break; int len = ReadFrame(file, buffer, Length, sizeof(buffer)); if(len < TS_SIZE) { isyslog("Failed to read live buffer data"); break; } // if if(Data && Independent && (search_pts == TsGetPts(buffer, len))) { found = true; break; } // if if (index) index->Write(Independent, fileName->Number(), fileSize); if (recordFile->Write(buffer, len) < 0) { isyslog("Failed to write live buffer data"); break; } // if fileSize += len; } // while if(Data) { isyslog("%lld bytes from live buffer %swritten to recording", fileSize, found ? "seamless ": ""); if(!found && fileSize) TsSetTeiOnBrokenPackets(Data, Size); ((cLiveIndex *)liveBufferIndex)->SetBufferStart(0); liveBufferIndex = NULL; } else if(((cLiveIndex *)liveBufferIndex)->WritingBufferCanceled()) { isyslog("%lld bytes from live buffer written to recording (aborted)", fileSize); ((cLiveIndex *)liveBufferIndex)->SetBufferStart(0); liveBufferIndex = NULL; } // if } else if (Data && fileSize) TsSetTeiOnBrokenPackets(Data, Size); } // cBufferRecorder::FillInitialData
void cDirCrawler::Action() { cThreadLock threadLock(this); const char* DirName = pwd.path.c_str(); int LinkLevel = pwd.linkLevel; isyslog("thread %d, Dir '%s'", ThreadId(), DirName); cReadDir d(DirName); struct dirent *e; while (Running() && (e = d.Next()) != NULL) { // Ignore NULL or empty names and all hidden directories and files if (!e->d_name || !strlen(e->d_name) || e->d_name[0] == '.') continue; // construct full path cString buffer(AddDirectory(DirName, e->d_name)); struct stat st; // check if path is a link if (lstat(buffer, &st) != 0) continue; // error if (S_ISLNK(st.st_mode)) { ++LinkLevel; // too many symlink in this path, maybe cyclic if (LinkLevel > MAX_LINK_LEVEL) { isyslog("max link level exceeded - not scanning %s", *buffer); continue; } if (stat(buffer, &st) != 0) continue; // error } cPath nextPath; nextPath.path = *buffer; nextPath.linkLevel = LinkLevel; // if subdirectory, put it in the directory Queue for other threads if (S_ISDIR(st.st_mode)) { isyslog("pwd: %s got '%s' , push '%s'", DirName, e->d_name, *buffer); dirQ->AddPath(nextPath); } else if (S_ISREG(st.st_mode)) { nextPath.filename = e->d_name; // a file AddPathToDatabase(nextPath); } } // while } // Action()
void cDynamicDevice::InternSetGetTSTimeout(int Seconds) { getTSTimeout = Seconds; if (subDevice == NULL) return; // no log message if no device is connected if (Seconds == 0) isyslog("dynamite: disable GetTSTimeout on device %s", GetDevPath()); else isyslog("dynamite: set GetTSTimeout on device %s to %d seconds", GetDevPath(), Seconds); }
bool cPinStatusMonitor::ChannelProtected(const cDevice *Device, const cChannel* Channel) { char* buf; const cEvent* event; if (cOsd::pinValid) return false; if (!Channel || !Channel->Name() || Channel->GroupSep()) return false; // first check channel protection /* isyslog("checking protection of channel '%s', '%s'", Channel->Name(), Channel->ShortName()); */ if ((cPinPlugin::getObject())->channelProtected(Channel->Name())) { isyslog("channel %d '%s' is protected", Channel->Number(), Channel->Name()); if (cPinPlugin::skipChannelSilent) return true; asprintf(&buf, "%d %s - %s", Channel->Number(), Channel->Name(), tr("channel is protected")); Skins.Message(mtInfo, buf); free(buf); return true; } // second check broadcast protection if (!(event = GetEventOf(Channel))) return false; if ((cPinPlugin::getObject())->broadcastProtected(event->Title())) { if (cPinPlugin::skipChannelSilent) return true; isyslog("broadcast '%s' is protected", event->Title()); asprintf(&buf, "%s - %s", event->Title(), tr("broadcast is protected")); Skins.Message(mtInfo, buf); free(buf); return true; } return false; }
bool cPluginDynamite::SetupParse(const char *Name, const char *Value) { int replyCode; if (strcasecmp(Name, "DefaultGetTSTimeout") == 0) SVDRPCommand("SetDefaultGetTSTimeout", Value, replyCode); else if (strcasecmp(Name, "GetTSTimeoutHandler") == 0) { if (getTSTimeoutHandler != NULL) delete getTSTimeoutHandler; getTSTimeoutHandler = NULL; if (Value != NULL) { getTSTimeoutHandler = new cString(Value); isyslog("dynamite: installing GetTS-Timeout-Handler %s", **getTSTimeoutHandler); } } else if (strcasecmp(Name, "FreeDeviceSlots") == 0) { int tmp = strtol(Value, NULL, 10); if ((tmp >= 0) && (tmp < MAXDEVICES)) freeDeviceSlots = tmp; else esyslog("dynamite: \"%d\" free device slots is out of range", tmp); } else if (strcasecmp(Name, "AttachHook") == 0) { if (cDynamicDevice::attachHook != NULL) delete cDynamicDevice::attachHook; cDynamicDevice::attachHook = NULL; if (Value != NULL) { cDynamicDevice::attachHook = new cString(Value); isyslog("dynamite: installing attach-hook %s", **cDynamicDevice::attachHook); } } else if (strcasecmp(Name, "IdleHook") == 0) { if (cDynamicDevice::idleHook != NULL) delete cDynamicDevice::idleHook; cDynamicDevice::idleHook = NULL; if (Value != NULL) { cDynamicDevice::idleHook = new cString(Value); isyslog("dynamite: installing idle-hook %s", **cDynamicDevice::idleHook); } } else if (strcasecmp(Name, "IdleTimeout") == 0) { int tmp = strtol(Value, NULL, 10); if (tmp >= 0) cDynamicDevice::idleTimeoutMinutes = tmp; } else if (strcasecmp(Name, "IdleWakeup") == 0) { int tmp = strtol(Value, NULL, 10); if (tmp >= 0) cDynamicDevice::idleWakeupHours = tmp; } else return false; return true; }
void cGStreamerVideoSrc::Action(void) { isyslog("%s", __PRETTY_FUNCTION__); /* Initialisation */ gst_init (NULL, NULL); /* Create gstreamer elements */ GstElement *pipeline = gst_parse_launch("appsrc name=vdrsource" " ! mpegpsdemux name=demux" " { demux." " ! queue max-size-buffers=0 max-size-time=0 name=queue1" " ! mpeg2dec name=dec" " ! ffdeinterlace mode=auto name=deinterlace" " ! " VIDEO_SINK " name=video" " }" " { demux." " ! queue max-size-buffers=0 max-size-time=0 name=queue2" " ! mad name=mad" " ! " AUDIO_SINK " name=audio" " } " , NULL); // "filesink location=/tmp/test.pes", NULL); if (!pipeline) { isyslog("!pipeline"); return; } mVdrSrc = gst_bin_get_by_name (GST_BIN(pipeline), "vdrsource"); if (!mVdrSrc) { if (pipeline) gst_object_unref (GST_OBJECT (pipeline)); isyslog("!mVdrSrc"); return; } /* Set the pipeline to "playing" state*/ gst_element_set_state (pipeline, GST_STATE_PLAYING); /* Iterate */ mLoop = g_main_loop_new (NULL, FALSE); isyslog("MainLoop running"); g_main_loop_run (mLoop); isyslog("MainLoop done"); /* Out of the main loop, clean up nicely */ gst_element_set_state (pipeline, GST_STATE_NULL); if (pipeline) { gst_object_unref (GST_OBJECT (pipeline)); pipeline = NULL; } }
eDynamicDeviceReturnCode cDynamicDevice::DetachDevice(const char *DevPath, bool Force) { if (!DevPath) return ddrcNotSupported; cMutexLock lock(&arrayMutex); int freeIndex = -1; int index = -1; if (isnumber(DevPath)) index = strtol(DevPath, NULL, 10) - 1; else index = IndexOf(DevPath, freeIndex, -1); if ((index < 0) || (index >= numDynamicDevices)) { esyslog("dynamite: device %s not found", DevPath); return ddrcNotFound; } cString realDevPath(dynamicdevice[index]->GetDevPath()); if (!Force) { if (!dynamicdevice[index]->isDetachable) { esyslog("dynamite: detaching of device %s is not allowed", *realDevPath); return ddrcNotAllowed; } if (dynamicdevice[index] == PrimaryDevice()) { esyslog("dynamite: detaching of primary device %s is not supported", *realDevPath); return ddrcIsPrimaryDevice; } if (dynamicdevice[index]->Receiving(false)) { esyslog("dynamite: can't detach device %s, it's receiving something important", *realDevPath); return ddrcIsReceiving; } } dynamicdevice[index]->DeleteSubDevice(); isyslog("dynamite: detached device %s%s", *realDevPath, (Force ? " (forced)" : "")); if (enableOsdMessages) { cString osdMsg = cString::sprintf(tr("detached %s"), *realDevPath); Skins.QueueMessage(mtInfo, *osdMsg); } if (attachHook != NULL) { cString hookCmd = cString::sprintf("%s --action=detach --device=%s", **attachHook, *realDevPath); isyslog("dynamite: calling hook %s", *hookCmd); int status = SystemExec(*hookCmd, true); if (!WIFEXITED(status) || WEXITSTATUS(status)) esyslog("SystemExec() failed with status %d", status); } return ddrcSuccess; }
int cPinPlugin::initPluginList() { static int initialized = no; cPlugin* plugin; int i = 0; int cnt = 0; cLockItem* item; if (initialized) return done; initialized = yes; #ifdef __EXCL_PLUGINS isyslog("exclude plugins '%s' from pin protection", __EXCL_PLUGINS); #endif while ((plugin = cPluginManager::GetPlugin(i))) { if (strcasecmp(plugin->Name(), "pin") != 0 #ifdef __EXCL_PLUGINS && !strstr(__EXCL_PLUGINS, plugin->Name())) #endif { // nicht das pin plugin und nicht in der Exclude Liste if (!(item = lockedPlugins.FindByName(plugin->Name()))) { lockedPlugins.Add(new cLockItem(plugin->Name(), no, plugin->MainMenuEntry())); isyslog("PIN added plugin (%d) '%s' - '%s'", i, plugin->Name(), plugin->MainMenuEntry()); cnt++; } else { item->SetTitle(plugin->MainMenuEntry()); } } i++; }; if (cnt) lockedPlugins.Save(); return done; }
eKeys cSkins::Message(eMessageType Type, const char *s, int Seconds) { if (!cThread::IsMainThread()) { dsyslog("cSkins::Message() called from background thread - ignored! (Use cSkins::QueueMessage() instead)"); return kNone; } switch (Type) { case mtInfo: isyslog("info: %s", s); break; case mtWarning: isyslog("warning: %s", s); break; case mtError: esyslog("ERROR: %s", s); break; default: ; } if (!Current()) return kNone; if (!cSkinDisplay::Current()) { if (displayMessage) delete displayMessage; displayMessage = Current()->DisplayMessage(); } cSkinDisplay::Current()->SetMessage(Type, s); cSkinDisplay::Current()->Flush(); cStatus::MsgOsdStatusMessage(s); eKeys k = kNone; if (Type != mtStatus) { k = Interface->Wait(Seconds); if (displayMessage) { delete displayMessage; displayMessage = NULL; cStatus::MsgOsdClear(); } else { cSkinDisplay::Current()->SetMessage(Type, NULL); cStatus::MsgOsdStatusMessage(NULL); } } else if (!s && displayMessage) { delete displayMessage; displayMessage = NULL; cStatus::MsgOsdClear(); } return k; }
void cDynamicDevice::DeleteSubDevice() { subDeviceIsReady = false; if (subDevice) { Cancel(3); if (cTransferControl::ReceiverDevice() == this) cControl::Shutdown(); subDevice->StopSectionHandler(); delete subDevice; subDevice = NULL; isyslog("dynamite: deleted device for %s", (devpath ? **devpath : "(unknown)")); if (devpath) cPluginManager::CallAllServices("dynamite-event-DeviceDetached-v0.1", (void*)**devpath); } if (udevRemoveSyspath) { cUdevUsbRemoveFilter::RemoveItem(**udevRemoveSyspath, GetDevPath()); delete udevRemoveSyspath; udevRemoveSyspath = NULL; } if (udevProvidesSources) { delete udevProvidesSources; udevProvidesSources = NULL; } if (devpath) { delete devpath; devpath = NULL; } isDetachable = true; getTSTimeout = defaultGetTSTimeout; disableAutoIdle = false; }
eOSState cMenuEpgTimers::Delete(void) { // Check if this timer is active: cTimer *ti = CurrentTimer(); if (ti) { if (Interface->Confirm(tr("Delete timer?"))) { if (ti->Recording()) { if (Interface->Confirm(tr("Timer still recording - really delete?"))) { ti->Skip(); cRecordControls::Process(time(NULL)); } else return osContinue; } isyslog("deleting timer %s", *ti->ToDescr()); if(!Timers.Del(ti)) Skins.Message(mtError, trVDR("Could not delete timer")); //cOsdMenu::Del(Current()); Timers.SetModified(); //Display(); } } else { cMenuSwitchTimerItem *item = dynamic_cast<cMenuSwitchTimerItem*> (Get(Current())); if (item && item->switchTimer && Interface->Confirm(tr("Delete switchtimer?"))) { cMutexLock SwitchTimersLock(&SwitchTimers); SwitchTimers.Del(item->switchTimer); SwitchTimers.Save(); Del(Current()); } } return osContinue; }
void cSchedules::Cleanup(bool Force) { if (Force) lastDump = 0; time_t now = time(NULL); struct tm tm_r; struct tm *ptm = localtime_r(&now, &tm_r); if (now - lastCleanup > 3600) { isyslog("cleaning up schedules data"); cSchedulesLock SchedulesLock(true, 1000); cSchedules *s = (cSchedules *)Schedules(SchedulesLock); if (s) { for (cSchedule *p = s->First(); p; p = s->Next(p)) p->Cleanup(now); } lastCleanup = now; if (ptm->tm_hour == 5) ReportEpgBugFixStats(true); } if (epgDataFileName && now - lastDump > 600) { cSafeFile f(epgDataFileName); if (f.Open()) { Dump(f); f.Close(); } else LOG_ERROR; lastDump = now; } }
cGStreamerVideoSrc::~cGStreamerVideoSrc(void) { isyslog("%s", __PRETTY_FUNCTION__); gst_object_unref (GST_OBJECT (mVdrSrc) ); mVdrSrc = NULL; g_main_loop_quit(mLoop); Cancel(3); }
void cPinStatusMonitor::RecordingFile(const char* FileName) { char* path = 0; cRecordControl* rc; FILE* f; if (!FileName || !strlen(FileName)) return; rc = cRecordControls::GetRecordControl(FileName); //isyslog("checking if autoprotection for '%s' is needed", FileName); if (rc && rc->Timer() && rc->Timer()->Channel()) { if (rc->Timer()->FskProtection()) { asprintf(&path, "%s/%s", FileName, PROTECTION_FILE); isyslog("autoprotecting recording due to '%s'; channel '%s'; file '%s'", rc->Timer()->FskProtection() ? "timer configuration" : "of protected channel", rc->Timer()->Channel()->Name(), path); f = fopen(path, "w"); if (f) fclose(f); free(path); } } }
/* * returns true if the given device has partition table type as GPT * else returns false */ bool IsGPT(std::string device) { char command[512]; snprintf(command, 512, "LANG=\"C\" fdisk -l %s | grep GPT", device.c_str()); int ret = SystemExec(command); isyslog("SystemExec('%s') returns %d", command, ret); if (ret == 0) { isyslog("device: %s has GPT partition table", device.c_str()); return true; } isyslog("device: %s does not have GPT partition table", device.c_str()); return false; }
void cBlockDevice::CheckIfRootDevice(void) { #ifdef RBMINI /** the internal usb stick is on usb bus nr. 2 and is device nr. 4 */ dsyslog("setup: checking if \"/dev/sd%c\" is the internal usb-stick: %i\n", letter_, internal_); char buf[256]; std::string path = std::string("/sys/block/sd") + letter_ + "/device"; if (readlink(path.c_str(), buf, 256) != -1) { if (strncmp(buf, "../../devices/platform/cnxt1/usb2/2-1/2-1.2/2-1.2:1.0/host1/target1:0:0/1:0:0:0", 44) == 0) internal_ = true; } else esyslog("Error reading target of \"%s\": error \"%s\"", path.c_str(), strerror(errno)); #else internal_ = false; char buf[256]; //std::string path = std::string("/sys/block/sd") + _ + "/device"; if (readlink("/dev/root", buf, sizeof(buf)) == -1) esyslog("This device does not have /dev/root. Cannot find the root device"); else if (buf[2] == letter_) { isyslog("Device sd%c is the root device", letter_); internal_ = true; } #endif }
cDbusOsdMsg::~cDbusOsdMsg(void) { if (strcmp(action, "Close") == 0) { isyslog("dbus2vdr: deleting osd files at %s", *file); RemoveFileOrDir(*file, false); } }
cDBusOsdProvider::~cDBusOsdProvider() { _provider = NULL; isyslog("dbus2vdr: delete DBus-OSD-provider"); msgCond.Broadcast(); Cancel(10); }
bool UpdateFavChannelNames() { bool success = false; cChannel *ch = favourites.First(); cChannel *vdrCh = NULL; while (ch) { if (!ch->GroupSep()) { vdrCh = Channels.GetByChannelID(ch->GetChannelID()); if (vdrCh) { if (strcmp(vdrCh->Name(), ch->Name()) != 0) { isyslog("changing name of '%s' fav. channel", ch->Name()); ch->SetName(vdrCh->Name(), vdrCh->ShortName()?vdrCh->ShortName():"", vdrCh->Provider()?vdrCh->Provider():""); } // update Caids if they differ ch->ForceCaIds(vdrCh->Caids()); } else esyslog("fav. channel '%s' not found in vdr's channel list!", ch->Name()); } ch = favourites.Next(ch); } //while return success; }