Example #1
0
eOSState cCMDImage::Burn(char *file)
{
  MYDEBUG("DVD Schreiben '%s'", file);

  cFileInfo *info = new cFileInfo(DVDSwitchSetup.DVDWriteScript);

  if(!info->isExists())
  {
    MYDEBUG("Writescript existiert nicht");
    DELETENULL(info);
    OSD_ERRMSG(tr("Specified Writescript not exist!"));
    return osContinue;
  }
  if(!info->isExecutable())
  {
    MYDEBUG("Writescript l�sst sich nicht ausf�hren");
    DELETENULL(info);
    OSD_ERRMSG(tr("Cannot execute Writescript!"));
    return osContinue;
  }

  DELETENULL(info);

  info = new cFileInfo(file);

  if(Interface->Confirm(tr("Burn Now?")))
  {
    MYDEBUG("Starte Burn-Thread");
    cCMDImageBurnThread *burn = new cCMDImageBurnThread(file, info->Type());
    burn->Start();
    cRemote::CallPlugin("bgprocess");
  }

  return osContinue;
}
bool cSoppalusikkaLogoCache::LoadXpm(const char *fileNameP)
{
  struct stat stbuf;
  cBitmap *bmp = new cBitmap(1, 1, 1);

  // create absolute filename
  cString filename = cString::sprintf("%s/%s.xpm", SoppalusikkaConfig.GetLogoDir(), fileNameP);
  debug1("%s (%s)", __PRETTY_FUNCTION__, *filename);
  // check validity
  if ((stat(*filename, &stbuf) == 0) && bmp->LoadXpm(*filename)) {
     // assign bitmap
     debug2("%s Logo found", __PRETTY_FUNCTION__);
     if (!DoubleEqual(1.0, xFactorM) || !DoubleEqual(1.0, yFactorM) || (bmp->Width() != DEFAULT_LOGO_WIDTH) || (bmp->Height() != DEFAULT_LOGO_HEIGHT)) {
        cBitmap *tmp = bmp;
        // scale bitmap keeping default proportions
        bmp = bmp->Scaled(yFactorM * DEFAULT_LOGO_WIDTH / bmp->Width(), yFactorM * DEFAULT_LOGO_HEIGHT / bmp->Height(), bmp->Bpp() > 4);
        debug2("%s Logo scaled", __PRETTY_FUNCTION__);
        DELETENULL(tmp);
        }
     bitmapM = bmp;
     return true;
     }
  // no valid xpm logo found - delete bitmap
  debug2("%s Logo not found or invalid resolution", __PRETTY_FUNCTION__);
  DELETENULL(bmp);
  bitmapM = NULL;
  return false;
}
Example #3
0
cConflictCheck::~cConflictCheck()
{
    if (evaltimeList)
    {
	evaltimeList->Clear();
	DELETENULL(evaltimeList);
    }
    if (timerList)
    {
	timerList->Clear();
	DELETENULL(timerList);
    }
    if (devices)
	delete [] devices;
}
Example #4
0
void cTimerThread::Exit(void) {
    if (m_Instance != NULL) {
	m_Instance->Stop();
	DELETENULL(m_Instance);
    }

}
Example #5
0
bool cFileList::DirIsIn(char *file, char *strings)
{
  bool ret = false;

  cFileInfo *fInfo = new cFileInfo(file);

  if(fInfo->Type() == tDir && strings && !isempty(strings))
  {
    cFileList *fList = new cFileList();
    char *buffer;

    cTokenizer *token = new cTokenizer(strings, "@");
    for(int i = 1; i <= token->Count(); i++)
    {
      asprintf(&buffer, "^%s$", token->GetToken(i));
      fList->OptInclude(buffer);
      free(buffer);
    }
    DELETENULL(token);

    fList->Load(file);
    if(fList->Count())
      ret = true;

    delete(fList);
  }

  delete(fInfo);

  return ret;
}
Example #6
0
eOSState cCMDDir::Edit(cMainMenuItem *mItem)
{
  MYDEBUG("Verzeichnis: Edit: %s", mItem->FileName());
  cFileInfo *info = new cFileInfo(mItem->FileName());
  if(!info->isWriteable())
  {
    DELETENULL(info);
    info = new cFileInfo(CurrentDir());
    if(!info->isWriteable())
    {
      MYDEBUG("Verzeichnis: Edit: Keine Rechte");
      OSD_ERRMSG(tr("no rights to rename"));
      DELETENULL(info);
      return osContinue;
    }
  }
  DELETENULL(info);
  info = new cFileInfo(mItem->FileName());
  SetDir(info->FileName());
  DELETENULL(info);
  State = csDirEdit;
  SetCols(11);
  SetTitle(CurrentDir());

  cMainMenuItem *dmItem = NULL;
  mItem = (cMainMenuItem*)First();
  while(mItem)
  {
    if(!strcasecmp(mItem->FileName(), LastSelDir()))
    {
      MYDEBUG("Verzeichnis: Edit: Item gefunden: %s", mItem->FileName());
      Ins(new cMenuEditStrItem(tr("Rename"), Dir, MaxFileName, trVDR(FileNameChars)),
          true,
          mItem);
      dmItem = mItem;
    }
    mItem->SetSelectable(false);
    mItem = (cMainMenuItem*)Next(mItem);
  }

  if(dmItem)
    Del(dmItem->Index());
  Display();
  cOsdMenu::ProcessKey(kRight);

  return osContinue;
}
Example #7
0
eOSState cCMDMove::ProcessKey(eKeys Key)
{
  cMainMenuItem *mItem = (cMainMenuItem*)Get(Current());
  cDirHandling *DirHand = NULL;
  cFileMoveThread *move = NULL;

  switch(Key)
  {
    case kUp:
    case kUp|k_Repeat:
    case kDown:
    case kDown|k_Repeat:
      cOsdMenu::ProcessKey(Key);
      SetHelp();
      mItem = (cMainMenuItem*)Get(Current());
      if(mItem)
        LastSelDir(mItem->FileName());
      return osContinue;
      break;
    case kOk:
      DirHand = new cDirHandling(this, this);
      DirHand->ProcessKey(mItem);
      DELETENULL(DirHand);
      Build();
      break;
    case kBlue:
      MYDEBUG("Verzeichnis: Move: Verschiede in: %s", CurrentDir());
      move = new cFileMoveThread(File, CurrentDir());
      if(move->OK())
      {
        MYDEBUG("Verzeichnis: Move: Erfolgreich");
        move->Start();
        cCondWait::SleepMs(1 * 500);
        OsdObject->SetState(mmsReInit);
      }
      else
        DELETENULL(move);
      if(!Dir && !Direct)
        cRemote::Put(kBack);
      return osBack;
      break;
    default:
      break;
  }

  return cOsdMenu::ProcessKey(Key);
}
bool cSoppalusikkaLogoCache::Load(const char *fileNameP)
{
  char *fileName = strdup(fileNameP);
  if (!fileName)
     return false;
  // replace '/' characters with '~'
  strreplace(fileName, '/', '~');
  debug1("%s (%s)", __PRETTY_FUNCTION__, fileName);
  // does the logo exist already in map
  std::map<std::string, cBitmap*>::iterator i = cacheMapM.find(fileName);
  if (i != cacheMapM.end()) {
     // yes - cache hit!
     debug2("%s Cache hit", __PRETTY_FUNCTION__);
     // check if logo really exist
     if (i->second == NULL) {
        debug2("%s Empty", __PRETTY_FUNCTION__);
        // empty logo in cache
        free(fileName);
        return false;
        }
     bitmapM = i->second;
     }
  else {
     // no - cache miss!
     debug2("%s Cache miss", __PRETTY_FUNCTION__);
     // try to load xpm logo
     LoadXpm(fileName);
     // check if cache is active
     if (cacheSizeM) {
        // update map
        if (cacheMapM.size() >= cacheSizeM) {
           // cache full - remove first
           debug2("%s Delete", __PRETTY_FUNCTION__);
           if (cacheMapM.begin()->second != NULL) {
              // logo exists - delete it
              cBitmap *bmp = cacheMapM.begin()->second;
              DELETENULL(bmp);
              }
           // erase item
           cacheMapM.erase(cacheMapM.begin());
           }
        // insert logo into map
        debug2("%s Insert %s", fileName, __PRETTY_FUNCTION__);
        cacheMapM.insert(std::make_pair(fileName, bitmapM));
        }
     // check if logo really exist
     if (bitmapM == NULL) {
        debug2("%s Empty", __PRETTY_FUNCTION__);
        // empty logo in cache
        free(fileName);
        return false;
        }
     }
  free(fileName);
  return true;
}
Example #9
0
bool cFemonSymbolCache::Flush(void)
{
  debug1("%s", __PRETTY_FUNCTION__);
  for (int i = 0; i < cacheM.Size(); ++i) {
      cBitmap *bmp = cacheM[i];
      DELETENULL(bmp);
      }
  cacheM.Clear();
  return true;
}
Example #10
0
cOsdMenu::~cOsdMenu()
{
    free(title);
    delete subMenu;
    free(status);
    displayMenu->Clear();
    cStatus::MsgOsdClear();
    if (!--displayMenuCount)
        DELETENULL(displayMenu);
}
Example #11
0
void cStreamdevFilters::SetConnection(int Handle) {

	Cancel(2);
	DELETENULL(m_TSBuffer);

	if (Handle >= 0) {
		m_TSBuffer = new cTSBuffer(Handle, MEGABYTE(1), 1);
		ReActivateFilters();
		Start();
	}
}
Example #12
0
eOSState cQuickShutdownCtl::ProcessKey(eKeys Key)
{
    if ((!m_QuickShutdown->IsActive() && !(Key == kNone)) || Key == kBack || Key == kOk
        || Key == kUp || Key == kDown || Key == kChanUp || Key == kChanDn
        || Key == kStop)
    {
        DELETENULL(m_QuickShutdown);
        return osEnd;
    }
    return osContinue;
}
Example #13
0
void cStreamdevStreamer::Stop(void) 
{
	if (Running()) {
		Dprintf("stopping streamer\n");
		Cancel(3);
	}
	if (m_Writer) {
		Detach();
		DELETENULL(m_Writer);
	}
}
Example #14
0
bool cEvent::Read(FILE *f, cSchedule *Schedule)
{
  if (Schedule) {
     cEvent *Event = NULL;
     char *s;
     int line = 0;
     cReadLine ReadLine;
     while ((s = ReadLine.Read(f)) != NULL) {
           line++;
           char *t = skipspace(s + 1);
           switch (*s) {
             case 'E': if (!Event) {
                          unsigned int EventID;
                          time_t StartTime;
                          int Duration;
                          unsigned int TableID = 0;
                          unsigned int Version = 0xFF; // actual value is ignored
                          int n = sscanf(t, "%u %ld %d %X %X", &EventID, &StartTime, &Duration, &TableID, &Version);
                          if (n >= 3 && n <= 5) {
                             Event = (cEvent *)Schedule->GetEvent(EventID, StartTime);
                             cEvent *newEvent = NULL;
                             if (Event)
                                DELETENULL(Event->components);
                             if (!Event) {
                                Event = newEvent = new cEvent(EventID);
                                Event->seen = 0;
                                }
                             if (Event) {
                                Event->SetTableID(TableID);
                                Event->SetStartTime(StartTime);
                                Event->SetDuration(Duration);
                                if (newEvent)
                                   Schedule->AddEvent(newEvent);
                                }
                             }
                          }
                       break;
             case 'e': if (Event && !Event->Title())
                          Event->SetTitle(tr("No title"));
                       Event = NULL;
                       break;
             case 'c': // to keep things simple we react on 'c' here
                       return true;
             default:  if (Event && !Event->Parse(s)) {
                          esyslog("ERROR: EPG data problem in line %d", line);
                          return false;
                          }
             }
           }
     esyslog("ERROR: unexpected end of file while reading EPG data");
     }
  return false;
}
Example #15
0
eOSState cCMDDir::New(eKeys Key)
{
  switch(Key)
  {
    case kOk:
      if(!isempty(Dir))
      {
        char *buffer = NULL;
        asprintf(&buffer, "%s/%s", CurrentDir(), stripspace(Dir));
        MYDEBUG("Verzeichnis: Neu: Anlegen: %s", buffer);
        cFileInfo *info = new cFileInfo(buffer);
        if(info->isExists())
        {
          MYDEBUG("Verzeichnis existiert bereits");
          OSD_WARNMSG(tr("Directory exists"));
          FREENULL(buffer);
          DELETENULL(info);
          return osContinue;
        }
        if(cFileCMD::Mkdir(buffer))
        {
          MYDEBUG("Verzeichnis anlegen erfolgreich");
          LastSelDir(buffer);
          if(!Select)
            OsdObject->SetState(mmsReInit);
        }
        FREENULL(buffer);
        DELETENULL(info);
      }
    case kBack:
      State = csNone;
      Build();
      return osContinue;
      break;
    default:
      break;
  }

  return cOsdMenu::ProcessKey(Key);
}
Example #16
0
void cRadioCheck::Exit(void) {
#ifdef REELVDR
    /* reactivate standard audio background pics */
    cPlugin *p = cPluginManager::GetPlugin("reelbox");
    if (p) p->Service("ToggleAudioPicPlayer", (void*)true);
    else cPluginManager::CallAllServices("EnableAudioPicPlayer");
#endif

    if (RadioCheck != NULL) {
        RadioCheck->Stop();
        DELETENULL(RadioCheck);
        }
}
Example #17
0
eOSState cCMDDir::Edit(eKeys Key)
{
  switch(Key)
  {
    case kOk:
      if(!isempty(Dir))
      {
        char *buffer = NULL;
        asprintf(&buffer, "%s/%s", CurrentDir(), stripspace(Dir));
        MYDEBUG("Verzeichnis: Edit: OK: %s", buffer);
        cFileInfo *info = new cFileInfo(buffer);
        if(info->isExists())
        {
          MYDEBUG("Verzeichnis: Edit: Existiert schon");
          OSD_WARNMSG(tr("Directory exists"));
          FREENULL(buffer);
          DELETENULL(info);
          return osUnknown;
        }
        if(cFileCMD::Rn(LastSelDir(), buffer))
        {
          MYDEBUG("Verzeichnis: Edit: Rename OK");
          LastSelDir(buffer);
          OsdObject->SetState(mmsReInit);
        }
        FREENULL(buffer);
        DELETENULL(info);
      }
    case kBack:
      State = csNone;
      Build();
      return osContinue;
      break;
    default:
      break;
  }

  return cOsdMenu::ProcessKey(Key);
}
Example #18
0
void cConflictCheck::Check()
{
    if (evaltimeList)
	DELETENULL(evaltimeList);
    if (timerList)
	DELETENULL(timerList);

    timerList = CreateCurrentTimerList();
    if (timerList) evaltimeList = CreateEvaluationTimeList(timerList);
    if (evaltimeList) failedList = CreateConflictList(evaltimeList, timerList);
    if (failedList)
    {
	for(cConflictCheckTime* checkTime = failedList->First(); checkTime; checkTime = failedList->Next(checkTime))
	{
	    LogFile.Log(2,"result of conflict check for %s:", DAYDATETIME(checkTime->evaltime));
	    std::set<cConflictCheckTimerObj*,TimerObjSort>::iterator it;
	    for (it = checkTime->failedTimers.begin(); it != checkTime->failedTimers.end(); ++it)
		LogFile.Log(2,"timer '%s' (%s, channel %s) failed", (*it)->timer->File(), DAYDATETIME((*it)->timer->StartTime()), CHANNELNAME((*it)->timer->Channel()));
	}
    }
    if (numConflicts > 0 && gl_timerStatusMonitor)
      gl_timerStatusMonitor->SetConflictCheckAdvised();
}
Example #19
0
void cFileList::SortIn(char *dir, char *file)
{
  cFileListItem *Item = First();
  cFileInfo *ItemInfo = NULL;
  char *NewItem = NULL;
  cFileInfo *NewItemInfo = NULL;

  switch(SortMode)
  {
    case sNone:
      Add(new cFileListItem(dir, file));
      break;
    case sAsc:
    case sDesc:
      if(Item)
      {
        asprintf(&NewItem, "%s/%s", dir, file);
        NewItemInfo = SortToFilename ? new cFileInfo(NewItem) : NULL;
        while(Item)
        {
          if(SortToFilename)
          {
            DELETENULL(ItemInfo);
            ItemInfo = new cFileInfo(Item->Value());
          }

          if((SortMode == sAsc && !SortToFilename && strcasecmp(NewItem, Item->Value()) < 0) ||
             (SortMode == sDesc && !SortToFilename && strcasecmp(NewItem, Item->Value()) > 0))
            break;
          if((SortMode == sAsc && SortToFilename && strcasecmp(NewItemInfo->FileName(), ItemInfo->FileName()) < 0) ||
             (SortMode == sDesc && SortToFilename && strcasecmp(NewItemInfo->FileName(), ItemInfo->FileName()) > 0))
            break;

          Item = Next(Item);
        }
      }
      if(Item)
        Ins(new cFileListItem(dir, file), Item);
      else
        Add(new cFileListItem(dir, file));
      break;
    default:
      break;
  }

  delete(NewItemInfo);
  delete(ItemInfo);
  free(NewItem);
}
Example #20
0
bool cDVDList::Load(char *dir, eFileList smode, bool sub)
{
  MYDEBUG("DVDList: Load");
  bool ret = false;
  int i = 0;

  cFileInfo *fInfo = NULL;
  cFileList *fList = new cFileList();

  fList->OptExclude("^lost\\+found$"); // lost+found Dir
  fList->OptExclude("^\\."); // hidden Files
  fList->OptExclude("\\.sdel$"); // del Files
  fList->OptExclude("\\.smove$"); // move Files

  if(DVDExts)
  {
    cTokenizer *token = new cTokenizer(DVDExts, "@");
    char *extexp = NULL;
    for(i = 1; i <= token->Count(); i++)
    {
      asprintf(&extexp, "%s$", token->GetToken(i));
      fList->OptInclude(extexp, tFile);
      FREENULL(extexp);
    }
    delete(token);
  }

  if(DVDDirs)
    fList->OptInclude(".*", tDir);

  fList->OptSort(smode, true);

  ret = fList->Load(dir, sub);

  cFileListItem *fItem = fList->First();
  while(*RunningMenu && fItem)
  {
    fInfo = new cFileInfo(fItem->Value());
    if(fInfo->Type() == tFile || (fInfo->Type() == tDir && fList->DirIsIn(fItem, DVDDirs)))
      Add(new cDVDListItem(fItem->Value()));
    DELETENULL(fInfo);
    fItem = fList->Next(fItem);
  }

  delete(fList);
  delete(fInfo);

  return ret;
}
Example #21
0
bool cReelLogoCache::Load(const char *fileNameP, int w, int h, bool fLogNotFound)
{
  if (fileNameP == NULL)
    return false;

  std::string strFilename;
  strFilename = ReelConfig.GetLogoPath(fileNameP, ".xpm");

  debug("cPluginSkinReel::Load(%s)", strFilename.c_str());
  // does the logo exist already in map
  std::map < std::string, cBitmap * >::iterator i = cacheMapM.find(strFilename.c_str());
  if (i != cacheMapM.end()) { /** yes - cache hit! */
    debug("cPluginSkinReel::Load() CACHE HIT!");
    if (i->second == NULL) { /** check if logo really exist */
      debug("cPluginSkinReel::Load() EMPTY");
      // empty logo in cache
      return false;
    }
    bitmapM = i->second;
  } else { /** no - cache miss! */
    debug("cPluginSkinReel::Load() CACHE MISS!");
    // try to load xpm logo
    if (!LoadXpm(strFilename.c_str(), w, h, fLogNotFound))
      return false;
    if (cacheSizeM) { /** check if cache is active */
      // update map
      if (cacheMapM.size() >= cacheSizeM) {
        // cache full - remove first
        debug("cPluginSkinReel::Load() DELETE");
        if (cacheMapM.begin()->second != NULL) {
          // logo exists - delete it
          cBitmap *bmp = cacheMapM.begin()->second;
          DELETENULL(bmp);
        }
        cacheMapM.erase(cacheMapM.begin()); /** erase item */
      }
      // insert logo into map
      debug("cPluginSkinReel::Load() INSERT(%s)", strFilename.c_str());
      cacheMapM.insert(std::make_pair(strFilename.c_str(), bitmapM));
    }
    // check if logo really exist
    if (bitmapM == NULL) {
      debug("cPluginSkinReel::Load() EMPTY");
      // empty logo in cache
      return false;
    }
  }
  return true;
}
Example #22
0
cQuickShutdownCtl::~cQuickShutdownCtl()
{
    m_Active = false;
    cStatus::MsgOsdClear();
    cPlugin *p = cPluginManager::GetPlugin("graphlcd");

    /* runScript==false means, vdr going into standby/shutdown,
     *  so donot switch the video and audio back
     */
    if (p && cQuickShutdownCtl::runScript) 
    {
        p->SetupParse("PluginActive", "1");

        //LCD
        //SystemExec("/sbin/reelfpctl -clearled 1");      // only standby-led
        //SystemExec("/sbin/reelfpctl -toptext \"\" -displaymode 0");
        SystemExec("quickshutdown.sh end" );
    
        /* since hdctrld -o DVI (in script) does not send 
         * audio through HDMI, reset settings in Reelbox-plugin
         */
        cPluginManager::CallAllServices("ReInit", NULL);


        // make sure volume is "on"
        cDevice::PrimaryDevice()->SetVolume(0); 

        //Get brightness set by user from graphlcd plugin and reset to that value
        int LCDbrightness = 8;
        p->Service("Get LCDBrightness Active", &LCDbrightness);

        char buffer[128];
        sprintf(buffer, "/sbin/reelfpctl -brightness %i", LCDbrightness);
        PRINTF("%s\n", buffer);
        SystemExec(buffer);
    }

    /*switch ON hdplayer */
    ToggleVideoOutput(1);

    p = cPluginManager::GetPlugin("osdteletext");

    if (p)
        p->Service("StartReceiver");


    DELETENULL(m_QuickShutdown);
}
Example #23
0
void cDvbSubtitleConverter::Reset(void)
{
  dbgconverter("Converter reset -----------------------\n");
  dvbSubtitleAssembler->Reset();
  Lock();
  pages->Clear();
  bitmaps->Clear();
  DELETENULL(osd);
  frozen = false;
  ddsVersionNumber = -1;
  displayWidth = windowWidth = 720;
  displayHeight = windowHeight = 576;
  windowHorizontalOffset = 0;
  windowVerticalOffset = 0;
  Unlock();
}
Example #24
0
File: player.c Project: axmhari/vdr
void cPictureControl::DisplayCaption(void)
{
  bool Force = false;
  cString Path = pictureEntry->Path();
  lastDisplayed = Path + strlen(pictures->Name()) + 1;
  const char *p = strrchr(Path, '/');
  const char *q = strrchr(lastPath, '/');
  if (p && q) {
     int lp = p - Path;
     int lq = q - lastPath;
     if (lp != lq || strncmp(lastPath, Path, lp)) {
        lastPath = Path;
        Force = true;
        }
     }
  if (!alwaysDisplayCaption && !Force) {
     DELETENULL(osd);
     return;
     }
  const cFont *Font = cFont::GetFont(fontOsd);
  int w = cOsd::OsdWidth();
  int h = 2 * Font->Height();
  if (!osd) {
     osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop() + cOsd::OsdHeight() - h, OSD_LEVEL_SUBTITLES);
     tArea Areas[] = { { 0, 0, w - 1, h - 1, 8 } };
     if (Setup.AntiAlias && osd->CanHandleAreas(Areas, sizeof(Areas) / sizeof(tArea)) == oeOk)
        osd->SetAreas(Areas, sizeof(Areas) / sizeof(tArea));
     else {
        tArea Areas[] = { { 0, 0, w - 1, h - 1, 4 } };
        osd->SetAreas(Areas, sizeof(Areas) / sizeof(tArea));
        }
     }
  const char *Year = pictureEntry->Parent()->Parent() ? pictureEntry->Parent()->Parent()->Name() : "";
  cString Description = HandleUnderscores(pictureEntry->Parent()->Name());
  osd->DrawRectangle(0, 0, w - 1, h - 1, clrTransparent);
  DrawTextOutlined(osd, 0, 0, Description, clrWhite, clrBlack, Font);
  DrawTextOutlined(osd, 0, h / 2, Year, clrWhite, clrBlack, Font);
  struct stat sb;
  if (stat(Path, &sb) == 0) {
     cString Time = DayDateTime(sb.st_mtime);
     DrawTextOutlined(osd, w - Font->Width(Time), h / 2, Time, clrWhite, clrBlack, Font);
     }
  p++;
  Path.Truncate(-4); // don't display the ".mpg" extension
  DrawTextOutlined(osd, w - Font->Width(p), 0, p, clrWhite, clrBlack, Font);
  osd->Flush();
}
Example #25
0
File: player.c Project: axmhari/vdr
eOSState cPictureControl::ProcessKey(eKeys Key)
{
  switch (Key) {
    case kUp:
    case kPlay:   slideShowDelay.Set();
                  slideShow = true;
                  break;
    case kDown:
    case kPause:  slideShow = false;
                  break;
    case kLeft|k_Repeat:
    case kLeft:   NextPicture(-1);
                  slideShow = false;
                  break;
    case kRight|k_Repeat:
    case kRight:  NextPicture(+1);
                  slideShow = false;
                  break;
    case kOk:     if (osd && !alwaysDisplayCaption)
                     DELETENULL(osd);
                  else {
                     alwaysDisplayCaption = !alwaysDisplayCaption;
                     DisplayCaption();
                     }
                  break;
    case kGreen:
    case kPrev:   NextDirectory(-1);
                  slideShow = false;
                  break;
    case kYellow:
    case kNext:   NextDirectory(+1);
                  slideShow = false;
                  break;
    case kBlue:
    case kStop:   return osEnd;
    case kBack:   slideShow = false;
                  cRemote::CallPlugin(PLUGIN_NAME_I18N);
                  break;
    default: break;
    }
  if (slideShow && slideShowDelay.TimedOut()) {
     NextPicture(+1);
     slideShowDelay.Set(SlideShowDelay * 1000);
     }
  return osContinue;
}
bool cSoppalusikkaLogoCache::Flush(void)
{
  debug1("%s", __PRETTY_FUNCTION__);
  // check if map is empty
  if (!cacheMapM.empty()) {
     debug2("%s Non-empty", __PRETTY_FUNCTION__);
     // delete bitmaps and clear map
     std::map<std::string, cBitmap*>::iterator i = cacheMapM.begin();
     while (i != cacheMapM.end()) {
         cBitmap *bmp = i->second;
         cacheMapM.erase(i++);
         DELETENULL(bmp);
         }
     // nullify bitmap pointer
     bitmapM = NULL;
     }
  return true;
}
Example #27
0
void cDvbSubtitleConverter::Action(void)
{
  int LastSetupLevel = setupLevel;
  cTimeMs Timeout;
  while (Running()) {
        int WaitMs = 100;
        if (!frozen) {
           LOCK_THREAD;
           if (osd) {
              int NewSetupLevel = setupLevel;
              if (Timeout.TimedOut() || LastSetupLevel != NewSetupLevel) {
                 DELETENULL(osd);
                 }
              LastSetupLevel = NewSetupLevel;
              }
           if (cDvbSubtitleBitmaps *sb = bitmaps->First()) {
              int64_t STC = cDevice::PrimaryDevice()->GetSTC();
              int64_t Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC); // some devices only deliver 32 bits
              if (Delta > (int64_t(1) << 31))
                 Delta -= (int64_t(1) << 32);
              else if (Delta < -((int64_t(1) << 31) - 1))
                 Delta += (int64_t(1) << 32);
              Delta /= 90; // STC and PTS are in 1/90000s
              if (Delta <= MAXDELTA) {
                 if (Delta <= 0) {
                    dbgconverter("Got %d bitmaps, showing #%d\n", bitmaps->Count(), sb->Index() + 1);
                    if (AssertOsd()) {
                       sb->Draw(osd);
                       Timeout.Set(sb->Timeout() * 1000);
                       dbgconverter("PTS: %"PRId64"  STC: %"PRId64" (%"PRId64") timeout: %d\n", sb->Pts(), cDevice::PrimaryDevice()->GetSTC(), Delta, sb->Timeout());
                       }
                    bitmaps->Del(sb);
                    }
                 else if (Delta < WaitMs)
                    WaitMs = Delta;
                 }
              else
                 bitmaps->Del(sb);
              }
           }
        cCondWait::SleepMs(WaitMs);
        }
}
Example #28
0
bool cFileCMD::Del(char *file)
{
  cFileInfo *info = new cFileInfo(file);
  cFileList *list = NULL;
  cFileListItem *item = NULL;
  bool ret = true;

  switch(info->Type())
  {
    case tDir:
      list = new cFileList();
      list->OptSort(sDesc);
      if(list->Load(file, true))
      {
        item = list->First();
        while(item)
        {
          DELETENULL(info);
          info = new cFileInfo(item->Value());
          if(info->Type() == tFile && remove(item->Value()) < 0)
            ret = false;
          if(info->Type() == tDir && rmdir(item->Value()) < 0)
            ret = false;
          item = list->Next(item);
        }
      } else
        ret = false;
      if(rmdir(file) < 0)
        ret = false;
      break;
    default:
      if(remove(file) < 0)
        ret = false;
      break;
  }

  delete(info);
  delete(list);

  return ret;
}
Example #29
0
cOsdMenu::~cOsdMenu()
{
#if REELVDR
    /* close any channel previews that were running with this menu */
    if(cReelBoxBase::Instance()) {
        cReelBoxBase::Instance()->StartPip(false);
        printf("\033[0;92mStop pip\033[0m\n");
    }
#endif

  free(title);
  delete subMenu;
  free(status);
  displayMenu->Clear();
  cStatus::MsgOsdClear();
#ifdef USE_GRAPHTFT
  cStatus::MsgOsdMenuDestroy();
#endif /* GRAPHTFT */
  if (!--displayMenuCount)
     DELETENULL(displayMenu);
}
Example #30
0
eOSState cCMDImage::Delete(char *file)
{
  MYDEBUG("l�sche DVD '%s'", file);
  if(file)
  {
    if(Interface->Confirm(tr("really delete?")))
    {
      cFileDelThread *del = new cFileDelThread(file);
      if(del->OK())
      {
        MYDEBUG("l�schen OK");
        del->Start();
        OsdObject->SetState(mmsReInitCur);
      }
      else
        DELETENULL(del);
    }
  }

  return osBack;
}