diff --git a/src/driver/vcrcontrol.cpp b/src/driver/vcrcontrol.cpp index cb053e0e9..1315ae48f 100644 --- a/src/driver/vcrcontrol.cpp +++ b/src/driver/vcrcontrol.cpp @@ -78,8 +78,9 @@ extern bool autoshift_delete; extern "C" { #include } -CMovieInfo * g_cMovieInfo; -MI_MOVIE_INFO * g_movieInfo; + +static CMovieInfo * g_cMovieInfo; +static MI_MOVIE_INFO * g_movieInfo; t_channel_id rec_channel_id; int safe_mkdir(char * path); @@ -118,6 +119,8 @@ void CVCRControl::registerDevice(CDevice * const device) unregisterDevice(); Device = device; + if(CNeutrinoApp::getInstance()->recordingstatus) + Device->deviceState = CMD_VCR_RECORD; } //------------------------------------------------------------------------- @@ -322,7 +325,8 @@ void CVCRControl::CFileAndServerDevice::RestoreNeutrino(void) if(CNeutrinoApp::getInstance()->getMode() != last_mode && CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_standby && last_mode != NeutrinoMessages::mode_standby) - if(!autoshift) g_RCInput->postMsg( NeutrinoMessages::CHANGEMODE , last_mode); + if(!autoshift) + g_RCInput->postMsg( NeutrinoMessages::CHANGEMODE , last_mode); if(last_mode == NeutrinoMessages::mode_standby && CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby ) @@ -495,7 +499,7 @@ bool CVCRControl::CFileDevice::Stop() //printf("[direct] Stop recording, g_movieInfo %lx\n", g_movieInfo); fflush(stdout); //FIXME why not save info if shift ? //if(!autoshift || autoshift_delete) - { + if(g_movieInfo && g_cMovieInfo) { // g_movieInfo->length = (end_time - start_time) / 60; g_movieInfo->length = (int) round((double) (end_time - start_time) / (double) 60); //printf("[direct] stop recording 1\n"); fflush(stdout); @@ -509,11 +513,15 @@ bool CVCRControl::CFileDevice::Stop() deviceState = CMD_VCR_STOP; - g_movieInfo->audioPids.clear(); - delete g_movieInfo; - g_movieInfo = NULL; - delete g_cMovieInfo; - g_cMovieInfo = NULL; + if(g_movieInfo) { + g_movieInfo->audioPids.clear(); + delete g_movieInfo; + g_movieInfo = NULL; + } + if(g_cMovieInfo) { + delete g_cMovieInfo; + g_cMovieInfo = NULL; + } return return_value; } @@ -832,12 +840,12 @@ bool CVCRControl::CServerDevice::serverConnect() return true; } -extern unsigned short g_vpid; -extern unsigned short g_vtype; -extern unsigned short g_apids[10]; -extern unsigned short g_ac3flags[10]; -extern unsigned short g_numpida; -extern unsigned int g_currentapid, g_currentac3; +unsigned short rec_vpid; +unsigned short rec_vtype; +unsigned short rec_apids[10]; +unsigned short rec_ac3flags[10]; +unsigned short rec_numpida; +unsigned int rec_currentapid, rec_currentac3; //------------------------------------------------------------------------- std::string CVCRControl::CFileAndServerDevice::getMovieInfoString(const CVCRCommand /*command*/, const t_channel_id channel_id, const event_id_t epgid, const std::string& epgTitle, APIDList apid_list, const time_t epg_time) @@ -891,12 +899,12 @@ std::string CVCRControl::CFileAndServerDevice::getMovieInfoString(const CVCRComm g_movieInfo->epgVideoPid = si.vpid; g_movieInfo->VideoType = si.vtype; - g_vpid = si.vpid; - g_vtype = si.vtype; - g_currentapid = si.apid; - memset(g_apids, 0, sizeof(unsigned short)*10); - memset(g_ac3flags, 0, sizeof(unsigned short)*10); - g_numpida = 0; + rec_vpid = si.vpid; + rec_vtype = si.vtype; + rec_currentapid = si.apid; + memset(rec_apids, 0, sizeof(unsigned short)*10); + memset(rec_ac3flags, 0, sizeof(unsigned short)*10); + rec_numpida = 0; EPG_AUDIO_PIDS audio_pids; // super hack :-), der einfachste weg an die apid descriptions ranzukommen @@ -910,18 +918,18 @@ std::string CVCRControl::CFileAndServerDevice::getMovieInfoString(const CVCRComm audio_pids.epgAudioPid = pids.APIDs[i].pid; audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); audio_pids.atype = pids.APIDs[i].is_ac3 ? 1 : pids.APIDs[i].is_aac ? 5 : 0; - audio_pids.selected = (audio_pids.epgAudioPid == (int) g_currentapid) ? 1 : 0; + audio_pids.selected = (audio_pids.epgAudioPid == (int) rec_currentapid) ? 1 : 0; g_movieInfo->audioPids.push_back(audio_pids); if(pids.APIDs[i].is_ac3) - g_ac3flags[i] = 1; + rec_ac3flags[i] = 1; if(pids.APIDs[i].is_aac) - g_ac3flags[i] = 5; + rec_ac3flags[i] = 5; - g_apids[i] = pids.APIDs[i].pid; - if(g_apids[i] == g_currentapid) - g_currentac3 = pids.APIDs[i].is_ac3 ? 1 : pids.APIDs[i].is_aac ? 5 : 0; - g_numpida++; + rec_apids[i] = pids.APIDs[i].pid; + if(rec_apids[i] == rec_currentapid) + rec_currentac3 = pids.APIDs[i].is_ac3 ? 1 : pids.APIDs[i].is_aac ? 5 : 0; + rec_numpida++; } } } diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 716c7d706..0002cce19 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -322,13 +322,16 @@ void CInfoViewer::showRecordIcon (const bool show) frameBuffer->paintBoxRel (ChanName_X + SHADOW_OFFSET, BoxStartY + box_pos + SHADOW_OFFSET, box_len, chanH, COL_INFOBAR_SHADOW_PLUS_0); frameBuffer->paintBoxRel (ChanName_X , BoxStartY + box_pos , box_len, chanH, COL_INFOBAR_PLUS_0); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString (ChanName_X +icon_w + (icon_space*2), BoxStartY + box_pos + chanH, box_len, ext_channel_name.c_str (), COL_INFOBAR, 0, true); - } else{ + } else { frameBuffer->paintBackgroundBoxRel (ChanName_X , BoxStartY + box_pos, box_len + SHADOW_OFFSET, chanH + SHADOW_OFFSET); } frameBuffer->paintIcon (autoshift ? NEUTRINO_ICON_AUTO_SHIFT : NEUTRINO_ICON_REC, ChanName_X + icon_space, BoxStartY + box_pos + (chanH - icon_h)/2); } else { - frameBuffer->paintBoxRel (ChanName_X + icon_space, BoxStartY + box_pos + (chanH - icon_h)/2, icon_w, icon_h,COL_INFOBAR_PLUS_0); + if (!autoshift && !shift_timer) + frameBuffer->paintBoxRel (ChanName_X + icon_space, BoxStartY + box_pos + (chanH - icon_h)/2, icon_w, icon_h,COL_INFOBAR_PLUS_0); + else + frameBuffer->paintBackgroundBoxRel (ChanName_X + icon_space, BoxStartY + box_pos + (chanH - icon_h)/2, icon_w, icon_h); } } } diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 648aa67d1..0aa110a36 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -24,6 +24,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + #ifdef HAVE_CONFIG_H #include #endif @@ -95,43 +96,30 @@ extern char rec_filename[512]; extern off64_t glob_limit; extern int glob_splits; -static CMoviePlayerGui::state playstate; -static bool isBookmark; -static bool isMovieBrowser = false; -int speed = 1; -int slow = 0; -static off64_t fullposition; // cur. position including all parts played -//static off64_t fulllength = 0; // len of all parts -int startposition; -int timeshift; -off64_t minuteoffset; -off64_t secondoffset; - -int file_prozent; - #ifndef __USE_FILE_OFFSET64 #error not using 64 bit file offsets #endif /* __USE_FILE__OFFSET64 */ -int streamingrunning; -CHintBox *hintBox; -std::string startfilename; -std::string skipvalue; +static unsigned short g_apids[10]; +static unsigned short g_ac3flags[10]; +static unsigned short g_numpida = 0; +static unsigned short g_vpid = 0; +static unsigned short g_vtype = 0; +static std::string g_language[10]; -int jumpminutes = 1; -static int g_jumpseconds = 0; -int buffer_time = 0; -unsigned short g_apids[10]; -unsigned short g_ac3flags[10]; -unsigned short g_numpida = 0; -unsigned short g_vpid = 0; -unsigned short g_vtype = 0; -std::string g_language[10]; +extern unsigned short rec_vpid; +extern unsigned short rec_vtype; +extern unsigned short rec_apids[10]; +extern unsigned short rec_ac3flags[10]; +extern unsigned short rec_numpida; +extern unsigned int rec_currentapid, rec_currentac3; + +static unsigned int g_currentapid = 0, g_currentac3 = 0, apidchanged = 0; -unsigned int g_currentapid = 0, g_currentac3 = 0, apidchanged = 0; std::string g_file_epg; std::string g_file_epg1; -bool showaudioselectdialog = false; +int file_prozent; +int timeshift; bool get_movie_info_apid_name(int apid, MI_MOVIE_INFO * movie_info, std::string * apidtitle) { @@ -214,6 +202,10 @@ void CMoviePlayerGui::Init(void) pesfilefilter.addFilter("mpv"); filebrowser->Filter = &tsfilefilter; rct = 0; + speed = 1; + slow = 0; + jumpseconds = 0; + showaudioselectdialog = false; } CMoviePlayerGui::~CMoviePlayerGui() @@ -231,18 +223,23 @@ CMoviePlayerGui::~CMoviePlayerGui() delete playback; } +bool CMoviePlayerGui::Playing(void) +{ + return stopped; +} + void CMoviePlayerGui::cutNeutrino() { if (stopped) return; - g_Zapit->setStandby(true); + stopped = true; + //g_Zapit->setStandby(true); + g_Zapit->lockPlayBack(); g_Sectionsd->setPauseScanning(true); CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_ts); m_LastMode = (CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap); - - stopped = true; } void CMoviePlayerGui::restoreNeutrino() @@ -250,13 +247,14 @@ void CMoviePlayerGui::restoreNeutrino() if (!stopped) return; - g_Zapit->setStandby(false); + stopped = false; + + //g_Zapit->setStandby(false); + g_Zapit->unlockPlayBack(); g_Sectionsd->setPauseScanning(false); CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, m_LastMode); //CVFD::getInstance()->showServicename(g_RemoteControl->getCurrentChannelName()); - - stopped = false; } int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) @@ -315,12 +313,11 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) } else #endif if (actionKey == "tsmoviebrowser") { - isMovieBrowser = true;// TESTTTTTTTTTTTTTTT + isMovieBrowser = true; timeshift = 0; PlayFile(); } else if (actionKey == "fileplayback") { - isMovieBrowser = false; timeshift = 0; PlayFile(); } @@ -380,7 +377,7 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) //return menu_return::RETURN_EXIT_ALL; } -void updateLcd(const std::string & sel_filename) +void CMoviePlayerGui::updateLcd(const std::string & sel_filename) { char tmp[20]; std::string lcd; @@ -439,12 +436,21 @@ void CMoviePlayerGui::PlayFile(void) bool time_forced = false; playstate = CMoviePlayerGui::STOPPED; bool is_file_player = false; - //unsigned short apid = 0, vpid = 0; - //int vtype = 0, atype = 0; if (has_hdd) system("(rm /hdd/.wakeup; touch /hdd/.wakeup; sync) > /dev/null 2> /dev/null &"); + if (timeshift) { + g_vpid = rec_vpid; + g_vtype = rec_vtype; + g_numpida = rec_numpida; + g_currentapid = rec_currentapid; + g_currentac3 = rec_currentac3; + for (int i = 0; i < g_numpida; i++) { + g_apids[i] = rec_apids[i]; + g_ac3flags[i] = rec_ac3flags[i]; + } + } timeb current_time; CMovieInfo cMovieInfo; // funktions to save and load movie info MI_MOVIE_INFO *p_movie_info = NULL; // movie info handle which comes from the MovieBrowser, if not NULL MoviePla yer is able to save new bookmarks @@ -589,27 +595,27 @@ void CMoviePlayerGui::PlayFile(void) if (play_sec >= p_movie_info->bookmarks.user[book_nr].pos && play_sec <= p_movie_info->bookmarks.user[book_nr].pos + 2 && play_sec > jump_not_until) // { //for plain bookmark, the following calc shall result in 0 (no jump) - g_jumpseconds = p_movie_info->bookmarks.user[book_nr].length; + jumpseconds = p_movie_info->bookmarks.user[book_nr].length; // we are close behind the bookmark, do bookmark activity (if any) if (p_movie_info->bookmarks.user[book_nr].length < 0) { // if the jump back time is to less, it does sometimes cause problems (it does probably jump only 5 sec which will cause the next jump, and so on) - if (g_jumpseconds > -15) - g_jumpseconds = -15; + if (jumpseconds > -15) + jumpseconds = -15; - g_jumpseconds = g_jumpseconds + p_movie_info->bookmarks.user[book_nr].pos; + jumpseconds = jumpseconds + p_movie_info->bookmarks.user[book_nr].pos; //playstate = CMoviePlayerGui::JPOS; // bookmark is of type loop, jump backward - playback->SetPosition(g_jumpseconds * 1000); + playback->SetPosition(jumpseconds * 1000); } else if (p_movie_info->bookmarks.user[book_nr].length > 0) { // jump at least 15 seconds - if (g_jumpseconds < 15) - g_jumpseconds = 15; - g_jumpseconds = g_jumpseconds + p_movie_info->bookmarks.user[book_nr].pos; + if (jumpseconds < 15) + jumpseconds = 15; + jumpseconds = jumpseconds + p_movie_info->bookmarks.user[book_nr].pos; //playstate = CMoviePlayerGui::JPOS; // bookmark is of type loop, jump backward - playback->SetPosition(g_jumpseconds * 1000); + playback->SetPosition(jumpseconds * 1000); } - TRACE("[mp] do jump %d sec\r\n", g_jumpseconds); + TRACE("[mp] do jump %d sec\r\n", jumpseconds); update_lcd = true; loop = false; // do no further bookmark checks } @@ -1218,7 +1224,13 @@ void CMoviePlayerGui::PlayFile(void) } else if (msg == CRCInput::RC_timeout) { // nothing - } else if ((msg == NeutrinoMessages::ANNOUNCE_RECORD) || msg == NeutrinoMessages::RECORD_START || msg == NeutrinoMessages::ZAPTO || msg == NeutrinoMessages::STANDBY_ON || msg == NeutrinoMessages::SHUTDOWN || msg == NeutrinoMessages::SLEEPTIMER) { // Exit for Record/Zapto Timers + } else if ( msg == NeutrinoMessages::ANNOUNCE_RECORD || + msg == NeutrinoMessages::RECORD_START) { + CNeutrinoApp::getInstance()->handleMsg(msg, data); + } else if ( msg == NeutrinoMessages::ZAPTO || + msg == NeutrinoMessages::STANDBY_ON || + msg == NeutrinoMessages::SHUTDOWN || + msg == NeutrinoMessages::SLEEPTIMER) { // Exit for Record/Zapto Timers exit = true; g_RCInput->postMsg(msg, data); } else { @@ -1231,7 +1243,7 @@ void CMoviePlayerGui::PlayFile(void) } if (exit) { -//printf("Exit, isMovieBrowser %d p_movie_info %x\n", isMovieBrowser, p_movie_info); +printf("CMoviePlayerGui::PlayFile: exit, isMovieBrowser %d p_movie_info %x\n", isMovieBrowser, (int) p_movie_info); if (isMovieBrowser == true && p_movie_info != NULL) { // if we have a movie information, try to save the stop position ftime(¤t_time); diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 21e65c3cd..fd29da29e 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -41,6 +41,7 @@ #include "gui/widget/menue.h" #include "gui/moviebrowser.h" #include "gui/movieinfo.h" +#include extern "C" { #include @@ -78,6 +79,18 @@ class CMoviePlayerGui : public CMenuTarget int m_LastMode; const char *filename; bool stopped; + CMoviePlayerGui::state playstate; + bool isBookmark; + bool isMovieBrowser; + int speed; + int slow; + off64_t fullposition; + int startposition; + int jumpseconds; + bool showaudioselectdialog; + off64_t minuteoffset; + off64_t secondoffset; + std::string startfilename; std::string Path_local; std::string Path_vlc; @@ -85,6 +98,7 @@ class CMoviePlayerGui : public CMenuTarget CFileBrowser * filebrowser; CMovieBrowser* moviebrowser; + CHintBox *hintBox; CBookmarkManager * bookmarkmanager; @@ -103,6 +117,8 @@ class CMoviePlayerGui : public CMenuTarget CMoviePlayerGui(); ~CMoviePlayerGui(); int exec(CMenuTarget* parent, const std::string & actionKey); + void updateLcd(const std::string & sel_filename); + bool Playing(); }; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index d3322d866..960911314 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3023,7 +3023,6 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) { int res = 0; neutrino_msg_t msg = _msg; -//printf("[neutrino] handleMsg %X data %X\n", msg, data); fflush(stdout); if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) { g_Zapit->getAudioMode(&g_settings.audio_AnalogMode); @@ -3103,7 +3102,6 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) res = res | g_InfoViewer->handleMsg(msg, data); res = res | channelList->handleMsg(msg, data); - //printf("[neutrino] handleMsg %X unhandled by others\n", msg); fflush(stdout); if( res != messages_return::unhandled ) { if( ( msg>= CRCInput::RC_WithData ) && ( msg< CRCInput::RC_WithData+ 0x10000000 ) ) delete (unsigned char*) data; @@ -3383,15 +3381,16 @@ printf("NeutrinoMessages::EVT_BOUQUETSCHANGED\n");fflush(stdout); { // passendes stop zur Aufnahme //CVCRControl * vcr_control = CVCRControl::getInstance(); if (CVCRControl::getInstance()->isDeviceRegistered()) { - if ((CVCRControl::getInstance()->getDeviceState() == CVCRControl::CMD_VCR_RECORD) || - (CVCRControl::getInstance()->getDeviceState() == CVCRControl::CMD_VCR_PAUSE )) + CVCRControl::CVCRStates state = CVCRControl::getInstance()->getDeviceState(); + if ((state == CVCRControl::CMD_VCR_RECORD) || + (state == CVCRControl::CMD_VCR_PAUSE )) { CVCRControl::getInstance()->Stop(); recordingstatus = 0; autoshift = 0; } else - printf("falscher state\n"); + printf("NeutrinoMessages::RECORD_STOP: false state %d\n", state); } else puts("[neutrino.cpp] no recording devices"); @@ -3633,33 +3632,39 @@ skip_message: if((data & mode_mask)== mode_radio) { if( mode != mode_radio ) { - if((data & norezap)==norezap) + radioMode((data & norezap) != norezap); +#if 0 + if((data & norezap) == norezap) radioMode(false); else radioMode(true); +#endif } } if((data & mode_mask)== mode_tv) { if( mode != mode_tv ) { - if((data & norezap)==norezap) + tvMode((data & norezap) != norezap); +#if 0 + if((data & norezap) == norezap) tvMode(false); else tvMode(true); +#endif } } - if((data &mode_mask)== mode_standby) { + if((data & mode_mask)== mode_standby) { if(mode != mode_standby) standbyMode( true ); } - if((data &mode_mask)== mode_audio) { + if((data & mode_mask)== mode_audio) { lastMode=mode; mode=mode_audio; } - if((data &mode_mask)== mode_pic) { + if((data & mode_mask)== mode_pic) { lastMode=mode; mode=mode_pic; } - if((data &mode_mask)== mode_ts) { + if((data & mode_mask)== mode_ts && moviePlayerGui->Playing()) { if(mode == mode_radio) videoDecoder->StopPicture(); lastMode=mode; diff --git a/src/zapit/include/zapit/zapit.h b/src/zapit/include/zapit/zapit.h index 5656b8ba0..fd8cb8cdd 100644 --- a/src/zapit/include/zapit/zapit.h +++ b/src/zapit/include/zapit/zapit.h @@ -24,7 +24,7 @@ void internalSendChannels(int connfd, ZapitChannelList* channels, bool nonames); void sendBouquetChannels (int connfd, const unsigned int bouquet, CZapitClient::channelsMode mode = CZapitClient::MODE_CURRENT, bool nonames = false); void sendChannels (int connfd, const CZapitClient::channelsMode mode = CZapitClient::MODE_CURRENT, const CZapitClient::channelsOrder order = CZapitClient::SORT_BOUQUET); int startPlayBack(CZapitChannel *); -int stopPlayBack(bool stopemu); +int stopPlayBack(bool stop_camd); unsigned int zapTo(const unsigned int channel); unsigned int zapTo(const unsigned int bouquet, const unsigned int channel); unsigned int zapTo_ChannelID(const t_channel_id channel_id, const bool isSubService); diff --git a/src/zapit/lib/zapitclient.cpp b/src/zapit/lib/zapitclient.cpp index 018d33801..4cf8b26ce 100644 --- a/src/zapit/lib/zapitclient.cpp +++ b/src/zapit/lib/zapitclient.cpp @@ -935,11 +935,15 @@ void CZapitClient::stopPlayBack() void CZapitClient::lockPlayBack() { send(CZapitMessages::CMD_SB_LOCK_PLAYBACK); + CZapitMessages::responseCmd response; + CBasicClient::receive_data((char* )&response, sizeof(response)); close_connection(); } void CZapitClient::unlockPlayBack() { send(CZapitMessages::CMD_SB_UNLOCK_PLAYBACK); + CZapitMessages::responseCmd response; + CBasicClient::receive_data((char* )&response, sizeof(response)); close_connection(); } bool CZapitClient::isPlayBackActive() diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index eb448db8d..71a744ed5 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -329,19 +329,29 @@ CZapitClient::responseGetLastChannel load_settings(void) return lastchannel; } +static int camask = 1; // demux 0 +void start_camd(bool forupdate = false) +{ + if(currentMode & RECORD_MODE) { + if(rec_channel_id != live_channel_id) { + /* zap from rec. channel */ + camask = 1; + cam1->setCaPmt(channel->getCaPmt(), 0, 1); // demux 0 + } else if(forupdate) { //FIXME broken! + /* forupdate means pmt update for live channel, using old camask */ + cam0->setCaPmt(channel->getCaPmt(), 0, camask, true);// update + } else { + /* zap back to rec. channel */ + camask = 5; // demux 0 + 2 + cam0->setCaPmt(channel->getCaPmt(), 0, camask, true); // update + cam1->sendMessage(0,0); // stop/close + } + } else { + camask = 1; + cam0->setCaPmt(channel->getCaPmt(), 0, camask); + } +} -/* - * - find transponder - * - stop teletext, video, audio, pcr - * - tune - * - set up pids - * - start pcr, audio, video, teletext - * - start descrambler - * - * return 0 on success - * return -1 otherwise - * - */ static int pmt_update_fd = -1; static bool update_pmt = true; @@ -554,6 +564,8 @@ printf("[zapit] saving channel, apid %x sub pid %x mode %d volume %d\n", channel * if to recording channel, we must stop cam1 and update cam0 with live+rec camask. */ + start_camd(forupdate); +#if 0 static int camask = 1; // demux 0 if(currentMode & RECORD_MODE) { if(rec_channel_id != live_channel_id) { @@ -573,6 +585,7 @@ printf("[zapit] saving channel, apid %x sub pid %x mode %d volume %d\n", channel camask = 1; cam0->setCaPmt(channel->getCaPmt(), 0, camask); } +#endif //play: send_ca_id(1); if (update_pmt) @@ -657,6 +670,9 @@ void setTVMode(void) int getMode(void) { + int mode = currentMode & (~RECORD_MODE); + return mode; + if (currentMode & TV_MODE) return CZapitClient::MODE_TV; if (currentMode & RADIO_MODE) @@ -734,10 +750,6 @@ void parseScanInputXml(void) } } -/* - * return 0 on success - * return -1 otherwise - */ int start_scan(int scan_mode) { if (!scanInputParser) { @@ -760,7 +772,6 @@ int start_scan(int scan_mode) scan_runs = 0; return -1; } - //pthread_detach(scan_thread); return 0; } @@ -787,6 +798,7 @@ int start_fast_scan(int scan_mode, int opid) bool zapit_parse_command(CBasicMessage::Header &rmsg, int connfd) { + CZapitMessages::responseCmd response; DBG("cmd %d (version %d) received\n", rmsg.cmd, rmsg.version); if ((standby) && ((rmsg.cmd != CZapitMessages::CMD_SET_VOLUME) @@ -998,7 +1010,6 @@ bool zapit_parse_command(CBasicMessage::Header &rmsg, int connfd) } case CZapitMessages::CMD_BQ_RESTORE: { - CZapitMessages::responseCmd response; //2004.08.02 g_bouquetManager->restoreBouquets(); if(g_list_changed) { prepare_channels(frontend->getInfo()->type, diseqcType); @@ -1013,7 +1024,6 @@ bool zapit_parse_command(CBasicMessage::Header &rmsg, int connfd) } case CZapitMessages::CMD_REINIT_CHANNELS: { - CZapitMessages::responseCmd response; // Houdini: save actual channel to restore it later, old version's channel was set to scans.conf initial channel t_channel_id cid= channel ? channel->getChannelID() : 0; @@ -1030,7 +1040,6 @@ bool zapit_parse_command(CBasicMessage::Header &rmsg, int connfd) } case CZapitMessages::CMD_RELOAD_CURRENTSERVICES: { - CZapitMessages::responseCmd response; response.cmd = CZapitMessages::CMD_READY; CBasicServer::send_data(connfd, &response, sizeof(response)); DBG("[zapit] sending EVT_SERVICES_CHANGED\n"); @@ -1391,7 +1400,6 @@ printf("[zapit] recording mode: %d\n", msgSetRecordMode.activate);fflush(stdout) CZapitMessages::commandBoolean msgBoolean; CBasicServer::receive_data(connfd, &msgBoolean, sizeof(msgBoolean)); - CZapitMessages::responseCmd response; response.cmd = CZapitMessages::CMD_READY; CBasicServer::send_data(connfd, &response, sizeof(response)); #if 0 @@ -1432,7 +1440,6 @@ printf("[zapit] recording mode: %d\n", msgSetRecordMode.activate);fflush(stdout) case CZapitMessages::CMD_SB_STOP_PLAYBACK: stopPlayBack(false); - CZapitMessages::responseCmd response; response.cmd = CZapitMessages::CMD_READY; CBasicServer::send_data(connfd, &response, sizeof(response)); break; @@ -1440,10 +1447,15 @@ printf("[zapit] recording mode: %d\n", msgSetRecordMode.activate);fflush(stdout) case CZapitMessages::CMD_SB_LOCK_PLAYBACK: stopPlayBack(true); playbackStopForced = true; + response.cmd = CZapitMessages::CMD_READY; + CBasicServer::send_data(connfd, &response, sizeof(response)); break; case CZapitMessages::CMD_SB_UNLOCK_PLAYBACK: playbackStopForced = false; startPlayBack(channel); + start_camd(); + response.cmd = CZapitMessages::CMD_READY; + CBasicServer::send_data(connfd, &response, sizeof(response)); break; case CZapitMessages::CMD_SET_DISPLAY_FORMAT: { CZapitMessages::commandInt msg; @@ -1611,9 +1623,8 @@ DBG("NVOD insert %llx\n", CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPO if (msgBoolean.truefalse) { // if(videoDecoder && (currentMode & RECORD_MODE)) videoDecoder->freeze(); enterStandby(); - CZapitMessages::responseCmd presponse; - presponse.cmd = CZapitMessages::CMD_READY; - CBasicServer::send_data(connfd, &presponse, sizeof(presponse)); + response.cmd = CZapitMessages::CMD_READY; + CBasicServer::send_data(connfd, &response, sizeof(response)); } else leaveStandby(); break; @@ -1946,25 +1957,22 @@ int startPlayBack(CZapitChannel *thisChannel) return 0; } -int stopPlayBack(bool stopemu) +int stopPlayBack(bool stop_camd) { /* in record mode we stop onle cam1, while cam continue to decrypt recording channel */ - if(stopemu) { + if(stop_camd) { if(currentMode & RECORD_MODE) { /* if we recording and rec == live, only update camask on cam0, - * else stop cam1 - */ + * else stop cam1 */ if(live_channel_id == rec_channel_id) cam0->setCaPmt(channel->getCaPmt(), 0, 4, true); // demux 2, update else cam1->sendMessage(0,0); } else { cam0->sendMessage(0,0); - unlink("/tmp/pmt.tmp"); - } } @@ -1998,7 +2006,6 @@ in record mode we stop onle cam1, while cam continue to decrypt recording channe else dvbsub_stop(); - return 0; }