bool MythRecorder::IsTunable(MythChannel &channel) { m_conn.Lock(); XBMC->Log(LOG_DEBUG, "%s: called for recorder %i, channel %i", __FUNCTION__, ID(), channel.ID()); cmyth_inputlist_t inputlist = cmyth_get_free_inputlist(*m_recorder_t); bool ret = false; for (int i = 0; i < inputlist->input_count; ++i) { cmyth_input_t input = inputlist->input_list[i]; if ((int)input->sourceid != channel.SourceID()) { XBMC->Log(LOG_DEBUG, "%s: skip input, source id differs (channel: %i, input: %i)", __FUNCTION__, channel.SourceID(), input->sourceid); continue; } if (input->multiplexid && (int)input->multiplexid != channel.MultiplexID()) { XBMC->Log(LOG_DEBUG, "%s: skip input, multiplex id id differs (channel: %i, input: %i)", __FUNCTION__, channel.MultiplexID(), input->multiplexid); continue; } XBMC->Log(LOG_DEBUG,"%s: using recorder, input is tunable: source id: %i, multiplex id: channel: %i, input: %i)", __FUNCTION__, channel.SourceID(), channel.MultiplexID(), input->multiplexid); ret = true; break; } ref_release(inputlist); m_conn.Unlock(); if (!ret) { XBMC->Log(LOG_DEBUG,"%s: recorder is not tunable", __FUNCTION__); } return ret; }
bool PVRClientMythTV::OpenLiveStream(const PVR_CHANNEL &channel) { if (g_bExtraDebug) XBMC->Log(LOG_DEBUG,"%s - chanID: %i, channumber: %i", __FUNCTION__, channel.iUniqueId, channel.iChannelNumber); CLockObject lock(m_lock); if (m_rec.IsNull()) { // Suspend fileOps to avoid connection hang if (m_fileOps->IsRunning()) m_fileOps->Suspend(); // Enable playback mode: Keep quiet on connection if (m_pEventHandler) { m_pEventHandler->EnablePlayback(); } MythChannel chan = m_channels.at(channel.iUniqueId); for (std::vector<int>::iterator it = m_sources.at(chan.SourceID()).begin(); it != m_sources.at(chan.SourceID()).end(); it++) { m_rec = m_con.GetRecorder(*it); if (m_rec.ID() > 0 && !m_rec.IsRecording() && m_rec.IsTunable(chan)) { if (g_bExtraDebug) XBMC->Log(LOG_DEBUG,"%s: Opening new recorder %i", __FUNCTION__, m_rec.ID()); if (m_pEventHandler) { m_pEventHandler->SetRecorder(m_rec); } if (m_rec.SpawnLiveTV(chan)) return true; } m_rec = MythRecorder(); if (m_pEventHandler) { m_pEventHandler->SetRecorder(m_rec); // Redundant } } // Disable playback mode: Allow all if (m_pEventHandler) { m_pEventHandler->DisablePlayback(); } // Resume fileOps m_fileOps->Resume(); if (g_bExtraDebug) XBMC->Log(LOG_DEBUG,"%s - Done", __FUNCTION__); return false; } else { if (g_bExtraDebug) XBMC->Log(LOG_DEBUG,"%s - Done", __FUNCTION__); return true; } }