mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
record: add support to select recording demux; use CFEManager to allocate and lock frontend in use
This commit is contained in:
@@ -170,7 +170,7 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel /*, APIDList &
|
|||||||
apids[numpids++] = allpids.PIDs.pmtpid;
|
apids[numpids++] = allpids.PIDs.pmtpid;
|
||||||
|
|
||||||
if(record == NULL)
|
if(record == NULL)
|
||||||
record = new cRecord(RECORD_DEMUX);
|
record = new cRecord(channel->getRecordDemux() /*RECORD_DEMUX*/);
|
||||||
|
|
||||||
record->Open();
|
record->Open();
|
||||||
|
|
||||||
@@ -184,6 +184,9 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel /*, APIDList &
|
|||||||
return RECORD_FAILURE;
|
return RECORD_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!autoshift)
|
||||||
|
CFEManager::getInstance()->lockFrontend(frontend);//FIXME testing
|
||||||
|
|
||||||
start_time = time(0);
|
start_time = time(0);
|
||||||
SaveXml();
|
SaveXml();
|
||||||
|
|
||||||
@@ -223,6 +226,9 @@ bool CRecordInstance::Stop(bool remove_event)
|
|||||||
SaveXml();
|
SaveXml();
|
||||||
record->Stop();
|
record->Stop();
|
||||||
|
|
||||||
|
if(!autoshift)
|
||||||
|
CFEManager::getInstance()->unlockFrontend(frontend);//FIXME testing
|
||||||
|
|
||||||
CCamManager::getInstance()->Stop(channel_id, CCamManager::RECORD);
|
CCamManager::getInstance()->Stop(channel_id, CCamManager::RECORD);
|
||||||
|
|
||||||
if((autoshift && g_settings.auto_delete) /* || autoshift_delete*/) {
|
if((autoshift && g_settings.auto_delete) /* || autoshift_delete*/) {
|
||||||
@@ -806,7 +812,11 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons
|
|||||||
nextmap.push_back((CTimerd::RecordingInfo *)evt);
|
nextmap.push_back((CTimerd::RecordingInfo *)evt);
|
||||||
}
|
}
|
||||||
} else if(recmap.size() < RECORD_MAX_COUNT) {
|
} else if(recmap.size() < RECORD_MAX_COUNT) {
|
||||||
if(CutBackNeutrino(eventinfo->channel_id, mode)) {
|
#if 1//FIXME test
|
||||||
|
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(eventinfo->channel_id);
|
||||||
|
CFrontend * frontend = CFEManager::getInstance()->allocateFE(channel);
|
||||||
|
#endif
|
||||||
|
if(frontend && CutBackNeutrino(eventinfo->channel_id, mode)) {
|
||||||
std::string newdir;
|
std::string newdir;
|
||||||
if(dir && strlen(dir))
|
if(dir && strlen(dir))
|
||||||
newdir = std::string(dir);
|
newdir = std::string(dir);
|
||||||
@@ -818,6 +828,7 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons
|
|||||||
if (inst == NULL)
|
if (inst == NULL)
|
||||||
inst = new CRecordInstance(eventinfo, newdir, timeshift, StreamVTxtPid, StreamPmtPid);
|
inst = new CRecordInstance(eventinfo, newdir, timeshift, StreamVTxtPid, StreamPmtPid);
|
||||||
|
|
||||||
|
inst->frontend = frontend;
|
||||||
error_msg = inst->Record();
|
error_msg = inst->Record();
|
||||||
if(error_msg == RECORD_OK) {
|
if(error_msg == RECORD_OK) {
|
||||||
recmap.insert(std::pair<t_channel_id, CRecordInstance*>(eventinfo->channel_id, inst));
|
recmap.insert(std::pair<t_channel_id, CRecordInstance*>(eventinfo->channel_id, inst));
|
||||||
@@ -1452,6 +1463,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo
|
|||||||
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();
|
||||||
|
#if 0
|
||||||
if(live_channel_id != channel_id) {
|
if(live_channel_id != channel_id) {
|
||||||
if(SAME_TRANSPONDER(live_channel_id, channel_id)) {
|
if(SAME_TRANSPONDER(live_channel_id, channel_id)) {
|
||||||
printf("%s zapTo_record channel_id %llx\n", __FUNCTION__, channel_id);
|
printf("%s zapTo_record channel_id %llx\n", __FUNCTION__, channel_id);
|
||||||
@@ -1461,7 +1473,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo
|
|||||||
} else {
|
} else {
|
||||||
if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) {
|
if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) {
|
||||||
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap );
|
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap );
|
||||||
// Wenn wir im Standby waren, dann brauchen wir fürs streamen nicht aufwachen...
|
// When we were on standby, then we need not wake up for streaming
|
||||||
if(last_mode == NeutrinoMessages::mode_standby)
|
if(last_mode == NeutrinoMessages::mode_standby)
|
||||||
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_standby);
|
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_standby);
|
||||||
}
|
}
|
||||||
@@ -1476,7 +1488,36 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo
|
|||||||
if(!ret)
|
if(!ret)
|
||||||
printf("%s: failed to change channel\n", __FUNCTION__);
|
printf("%s: failed to change channel\n", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool mode_changed = false;
|
||||||
|
if(live_channel_id != channel_id) {
|
||||||
|
bool found = false;
|
||||||
|
if(SAME_TRANSPONDER(live_channel_id, channel_id)) {
|
||||||
|
found = true;
|
||||||
|
} else {
|
||||||
|
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
|
||||||
|
if(SAME_TRANSPONDER(it->first, channel_id)) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(found) {
|
||||||
|
ret = g_Zapit->zapTo_record(channel_id) > 0;
|
||||||
|
printf("%s found same tp, zapTo_record channel_id %llx result %d\n", __FUNCTION__, channel_id, ret);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("%s mode %d last_mode %d getLastMode %d\n", __FUNCTION__, mode, last_mode, CNeutrinoApp::getInstance()->getLastMode());
|
||||||
|
if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) {
|
||||||
|
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap );
|
||||||
|
mode_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = g_Zapit->zapTo_serviceID(channel_id) > 0;
|
||||||
|
printf("%s zapTo_serviceID channel_id %llx result %d\n", __FUNCTION__, channel_id, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(ret) {
|
if(ret) {
|
||||||
if(StopSectionsd) {
|
if(StopSectionsd) {
|
||||||
printf("%s: g_Sectionsd->setPauseScanning(true)\n", __FUNCTION__);
|
printf("%s: g_Sectionsd->setPauseScanning(true)\n", __FUNCTION__);
|
||||||
@@ -1488,6 +1529,12 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo
|
|||||||
if(last_mode == NeutrinoMessages::mode_standby)
|
if(last_mode == NeutrinoMessages::mode_standby)
|
||||||
g_Zapit->stopPlayBack();
|
g_Zapit->stopPlayBack();
|
||||||
}
|
}
|
||||||
|
if(last_mode == NeutrinoMessages::mode_standby) {
|
||||||
|
//CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_standby);
|
||||||
|
g_RCInput->postMsg( NeutrinoMessages::CHANGEMODE , last_mode);
|
||||||
|
} else if(!ret && mode_changed /*mode != last_mode*/)
|
||||||
|
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , last_mode);
|
||||||
|
|
||||||
printf("%s channel_id %llx mode %d : result %s\n", __FUNCTION__, channel_id, mode, ret ? "OK" : "BAD");
|
printf("%s channel_id %llx mode %d : result %s\n", __FUNCTION__, channel_id, mode, ret ? "OK" : "BAD");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include <gui/movieinfo.h>
|
#include <gui/movieinfo.h>
|
||||||
#include <zapit/channel.h>
|
#include <zapit/channel.h>
|
||||||
#include <zapit/client/zapittools.h>
|
#include <zapit/client/zapittools.h>
|
||||||
|
#include <zapit/femanager.h>
|
||||||
|
|
||||||
#if HAVE_COOL_HARDWARE
|
#if HAVE_COOL_HARDWARE
|
||||||
#include <record_cs.h>
|
#include <record_cs.h>
|
||||||
@@ -123,6 +124,8 @@ class CRecordInstance
|
|||||||
bool Timeshift() { return autoshift; };
|
bool Timeshift() { return autoshift; };
|
||||||
int tshift_mode;
|
int tshift_mode;
|
||||||
void SetStopMessage(const char* text) {rec_stop_msg = text;} ;
|
void SetStopMessage(const char* text) {rec_stop_msg = text;} ;
|
||||||
|
|
||||||
|
CFrontend * frontend;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<t_channel_id, CRecordInstance*> recmap_t;
|
typedef std::map<t_channel_id, CRecordInstance*> recmap_t;
|
||||||
|
Reference in New Issue
Block a user