mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
driver/record.cpp: move frontend selection to CutBackNeutrino()
This commit is contained in:
@@ -852,24 +852,8 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if(recmap.size() < RECORD_MAX_COUNT) {
|
if(recmap.size() < RECORD_MAX_COUNT) {
|
||||||
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(eventinfo->channel_id);
|
CFrontend * frontend = NULL;
|
||||||
|
if(CutBackNeutrino(eventinfo->channel_id, frontend)) {
|
||||||
/* first try to get frontend for record with locked live */
|
|
||||||
CFrontend *live_fe = CZapit::getInstance()->GetLiveFrontend();
|
|
||||||
bool unlock = true;
|
|
||||||
CFEManager::getInstance()->lockFrontend(live_fe);
|
|
||||||
CFrontend * frontend = CFEManager::getInstance()->allocateFE(channel);
|
|
||||||
if (frontend == NULL) {
|
|
||||||
/* no frontend, try again with unlocked live */
|
|
||||||
unlock = false;
|
|
||||||
CFEManager::getInstance()->unlockFrontend(live_fe);
|
|
||||||
frontend = CFEManager::getInstance()->allocateFE(channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
int mode = channel->getServiceType() != ST_DIGITAL_RADIO_SOUND_SERVICE ?
|
|
||||||
NeutrinoMessages::mode_tv : NeutrinoMessages::mode_radio;
|
|
||||||
|
|
||||||
if(frontend && CutBackNeutrino(eventinfo->channel_id, mode, frontend)) {
|
|
||||||
std::string newdir;
|
std::string newdir;
|
||||||
if(dir && strlen(dir))
|
if(dir && strlen(dir))
|
||||||
newdir = std::string(dir);
|
newdir = std::string(dir);
|
||||||
@@ -900,8 +884,6 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons
|
|||||||
printf("%s add %llx : %s to pending\n", __FUNCTION__, evt->channel_id, evt->epgTitle);
|
printf("%s add %llx : %s to pending\n", __FUNCTION__, evt->channel_id, evt->epgTitle);
|
||||||
nextmap.push_back((CTimerd::RecordingInfo *)evt);
|
nextmap.push_back((CTimerd::RecordingInfo *)evt);
|
||||||
}
|
}
|
||||||
if (unlock)
|
|
||||||
CFEManager::getInstance()->unlockFrontend(live_fe);
|
|
||||||
} else
|
} else
|
||||||
error_msg = RECORD_BUSY;
|
error_msg = RECORD_BUSY;
|
||||||
|
|
||||||
@@ -1493,35 +1475,42 @@ bool CRecordManager::RunStopScript(void)
|
|||||||
* if zap ok
|
* if zap ok
|
||||||
* set record mode
|
* set record mode
|
||||||
*/
|
*/
|
||||||
bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mode, CFrontend *frontend)
|
bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend * &frontend)
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id);
|
||||||
|
if (!channel)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int mode = channel->getServiceType() != ST_DIGITAL_RADIO_SOUND_SERVICE ?
|
||||||
|
NeutrinoMessages::mode_tv : NeutrinoMessages::mode_radio;
|
||||||
|
|
||||||
printf("%s channel_id %llx mode %d\n", __FUNCTION__, channel_id, mode);
|
printf("%s channel_id %llx mode %d\n", __FUNCTION__, channel_id, mode);
|
||||||
|
|
||||||
last_mode = CNeutrinoApp::getInstance()->getMode();
|
last_mode = CNeutrinoApp::getInstance()->getMode();
|
||||||
|
|
||||||
if(last_mode == NeutrinoMessages::mode_standby && recmap.empty())
|
if(last_mode == NeutrinoMessages::mode_standby && recmap.empty())
|
||||||
g_Zapit->setStandby(false); // this zap to live_channel_id
|
g_Zapit->setStandby(false); // this zap to live_channel_id
|
||||||
|
|
||||||
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
||||||
CFrontend *live_fe = CZapit::getInstance()->GetLiveFrontend();
|
|
||||||
|
|
||||||
bool mode_changed = false;
|
bool mode_changed = false;
|
||||||
|
CFrontend *live_fe = CZapit::getInstance()->GetLiveFrontend();
|
||||||
|
frontend = live_fe;
|
||||||
if(live_channel_id != channel_id) {
|
if(live_channel_id != channel_id) {
|
||||||
#if 0
|
/* first try to get frontend for record with locked live */
|
||||||
bool found = false;
|
bool unlock = true;
|
||||||
if(SAME_TRANSPONDER(live_channel_id, channel_id)) {
|
CFEManager::getInstance()->lockFrontend(live_fe);
|
||||||
found = true;
|
frontend = CFEManager::getInstance()->allocateFE(channel);
|
||||||
} else {
|
if (frontend == NULL) {
|
||||||
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
|
/* no frontend, try again with unlocked live */
|
||||||
if(SAME_TRANSPONDER(it->second->GetChannelId(), channel_id)) {
|
unlock = false;
|
||||||
found = true;
|
CFEManager::getInstance()->unlockFrontend(live_fe);
|
||||||
break;
|
frontend = CFEManager::getInstance()->allocateFE(channel);
|
||||||
}
|
}
|
||||||
}
|
if (frontend == NULL)
|
||||||
}
|
return false;
|
||||||
#endif
|
|
||||||
/* FIXME if we here, allocateFE was successful, full zapTo_serviceID
|
/* if allocateFE was successful, full zapTo_serviceID
|
||||||
* needed, if record frontend same as live, and its on different TP */
|
* needed, if record frontend same as live, and its on different TP */
|
||||||
bool found = (live_fe != frontend) || SAME_TRANSPONDER(live_channel_id, channel_id);
|
bool found = (live_fe != frontend) || SAME_TRANSPONDER(live_channel_id, channel_id);
|
||||||
if(found) {
|
if(found) {
|
||||||
@@ -1539,6 +1528,8 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo
|
|||||||
ret = g_Zapit->zapTo_serviceID(channel_id) > 0;
|
ret = g_Zapit->zapTo_serviceID(channel_id) > 0;
|
||||||
printf("%s zapTo_serviceID channel_id %llx result %d\n", __FUNCTION__, channel_id, ret);
|
printf("%s zapTo_serviceID channel_id %llx result %d\n", __FUNCTION__, channel_id, ret);
|
||||||
}
|
}
|
||||||
|
if (unlock)
|
||||||
|
CFEManager::getInstance()->unlockFrontend(live_fe);
|
||||||
}
|
}
|
||||||
if(ret) {
|
if(ret) {
|
||||||
if(StopSectionsd) {
|
if(StopSectionsd) {
|
||||||
|
@@ -154,7 +154,7 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/
|
|||||||
OpenThreads::Mutex mutex;
|
OpenThreads::Mutex mutex;
|
||||||
static OpenThreads::Mutex sm;
|
static OpenThreads::Mutex sm;
|
||||||
|
|
||||||
bool CutBackNeutrino(const t_channel_id channel_id, const int mode, CFrontend *frontend);
|
bool CutBackNeutrino(const t_channel_id channel_id, CFrontend * &frontend);
|
||||||
void RestoreNeutrino(void);
|
void RestoreNeutrino(void);
|
||||||
bool CheckRecording(const CTimerd::RecordingInfo * const eventinfo);
|
bool CheckRecording(const CTimerd::RecordingInfo * const eventinfo);
|
||||||
void StartNextRecording();
|
void StartNextRecording();
|
||||||
|
Reference in New Issue
Block a user