/** \fn LiveTVChain::SwitchTo(int) * \brief Sets the recording to switch to. * \param num Index of recording to switch to, -1 for last recording. */ void LiveTVChain::SwitchTo(int num) { QMutexLocker lock(&m_lock); LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("SwitchTo(%1)").arg(num)); int size = m_chain.count(); if ((num < 0) || (num >= size)) num = size - 1; if (m_curpos != num) { m_switchid = num; GetEntryAt(num, m_switchentry); } else LOG(VB_GENERAL, LOG_ERR, LOC + "SwitchTo() not switching to current"); if (VERBOSE_LEVEL_CHECK(VB_PLAYBACK, LOG_DEBUG)) { LiveTVChainEntry e; GetEntryAt(num, e); QString msg = QString("%1_%2") .arg(e.chanid).arg(e.starttime.toString("yyyyMMddhhmmss")); LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Entry@%1: '%2')").arg(num).arg(msg)); } }
/** \fn LiveTVChain::SwitchTo(int) * \brief Sets the recording to switch to. * \param num Index of recording to switch to, -1 for last recording. */ void LiveTVChain::SwitchTo(int num) { QMutexLocker lock(&m_lock); VERBOSE(VB_PLAYBACK, LOC + "SwitchTo("<<num<<")"); int size = m_chain.count(); if ((num < 0) || (num >= size)) num = size - 1; if (m_curpos != num) { m_switchid = num; GetEntryAt(num, m_switchentry); } else VERBOSE(VB_IMPORTANT, LOC + "SwitchTo() not switching to current"); if (VERBOSE_LEVEL_CHECK(VB_PLAYBACK)) { LiveTVChainEntry e; GetEntryAt(num, e); QString msg = QString("%1_%2") .arg(e.chanid).arg(e.starttime.toString("yyyyMMddhhmmss")); VERBOSE(VB_PLAYBACK, LOC + "Entry@"<<num<<": '"<<msg<<"'"); } }
QString LiveTVChain::GetCardType(int pos) const { LiveTVChainEntry entry; GetEntryAt(pos, entry); return entry.cardtype; }
QString LiveTVChain::GetInputName(int pos) const { LiveTVChainEntry entry; GetEntryAt(pos, entry); return entry.inputname; }
QString LiveTVChain::GetChannelName(int pos) const { LiveTVChainEntry entry; GetEntryAt(pos, entry); return entry.channum; }
/** \fn LiveTVChain::GetProgramAt(int) const * \brief Returns program at the desired location. * * NOTE: The caller must delete the returned program. * * \param at ProgramInfo to return [0..TotalSize()-1] or -1 for last program */ ProgramInfo *LiveTVChain::GetProgramAt(int at) const { LiveTVChainEntry entry; GetEntryAt(at, entry); return EntryToProgram(entry); }
static void Scroll() { for(unsigned int y = 1; y < VGA_BUFFER_HEIGHT; ++y) { for(unsigned int x = 0; x < VGA_BUFFER_WIDTH; ++x) { VgaEntry entry = GetEntryAt(x, y); SetEntryAt(x, y - 1, entry); } } VgaEntry whitespace = ConstructVgaEntry(' ', current_color_scheme); for(unsigned int x = 0; x < VGA_BUFFER_WIDTH; ++x) { SetEntryAt(x, VGA_BUFFER_HEIGHT - 1, whitespace); } MoveCursorAt(current_x, current_y - 1); }
/** * \brief Returns the recording we should switch to * * This returns a ProgramInfo* and tells us if this is a discontiuous * switch and whether the recording type is changing. * * This also clears the NeedsToSwitch()/NeedsToJump() state. * * NOTE: The caller is resposible for deleting the ProgramInfo */ ProgramInfo *LiveTVChain::GetSwitchProgram(bool &discont, bool &newtype, int &newid) { ReloadAll(); QMutexLocker lock(&m_lock); if (m_switchid < 0 || m_curpos == m_switchid) { ClearSwitch(); return NULL; } LiveTVChainEntry oldentry, entry; GetEntryAt(m_curpos, oldentry); ProgramInfo *pginfo = NULL; while (!pginfo && m_switchid < (int)m_chain.count() && m_switchid >= 0) { GetEntryAt(m_switchid, entry); bool at_last_entry = ((m_switchid > m_curpos) && (m_switchid == (int)(m_chain.count()-1))) || ((m_switchid <= m_curpos) && (m_switchid == 0)); // Skip dummy recordings, if possible. if (at_last_entry || (entry.cardtype != "DUMMY")) pginfo = EntryToProgram(entry); // Skip empty recordings, if possible if (pginfo && (0 == pginfo->GetFilesize()) && m_switchid < (int)(m_chain.count()-1)) { LOG(VB_GENERAL, LOG_WARNING, QString("Skipping empty program %1") .arg(pginfo->MakeUniqueKey())); delete pginfo; pginfo = NULL; } if (!pginfo) { if (m_switchid > m_curpos) m_switchid++; else m_switchid--; } } if (!pginfo) { ClearSwitch(); return NULL; } discont = true; if (m_curpos == m_switchid - 1) discont = entry.discontinuity; newtype = (oldentry.cardtype != entry.cardtype); // Some cards can change their streams dramatically on a channel change... if (discont) newtype |= CardUtil::IsChannelChangeDiscontinuous(entry.cardtype); newid = m_switchid; ClearSwitch(); return pginfo; }
/** * \brief Returns the recording we should switch to * * This returns a ProgramInfo* and tells us if this is a discontiuous * switch and whether the recording type is changing. * * This also clears the NeedsToSwitch()/NeedsToJump() state. * * NOTE: The caller is resposible for deleting the ProgramInfo */ ProgramInfo *LiveTVChain::GetSwitchProgram(bool &discont, bool &newtype, int &newid) { QMutexLocker lock(&m_lock); if (m_switchid < 0 || m_curpos == m_switchid) { ClearSwitch(); return NULL; } LiveTVChainEntry oldentry, entry; GetEntryAt(m_curpos, oldentry); ProgramInfo *pginfo = NULL; while (!pginfo && m_switchid < (int)m_chain.count() && m_switchid >= 0) { GetEntryAt(m_switchid, entry); pginfo = EntryToProgram(entry); if (!pginfo) { if (m_switchid > m_curpos) m_switchid++; else m_switchid--; } } if (!pginfo) { ClearSwitch(); return NULL; } // Skip dummy recordings, if possible. if (entry.cardtype == "DUMMY") { if (m_switchid > m_curpos && m_switchid + 1 < (int)m_chain.count()) m_switchid++; else if (m_switchid < m_curpos && m_switchid > 0) m_switchid--; GetEntryAt(m_switchid, entry); delete pginfo; pginfo = EntryToProgram(entry); if (!pginfo) { ClearSwitch(); return NULL; } } discont = true; if (m_curpos == m_switchid - 1) discont = entry.discontinuity; newtype = (oldentry.cardtype != entry.cardtype); // Some cards can change their streams dramatically on a channel change... if (discont) newtype |= CardUtil::IsChannelChangeDiscontinuous(entry.cardtype); newid = m_switchid; ClearSwitch(); return pginfo; }