From c1029f7a35cfa7eff8a0cad854fcd0db53e74eb1 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 6 May 2011 14:24:47 +0000 Subject: [PATCH] fix pmt update git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1433 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/5b03f2b747350f474403a2200334bfb2d3f6c474 Author: Jacek Jendrzej Date: 2011-05-06 (Fri, 06 May 2011) Origin message was: ------------------ -fix pmt update git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1433 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/zapit/src/zapit.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 8fcceaf70..774aad555 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -2274,15 +2274,27 @@ int zapit_main_thread(void *data) if (pmt_update_fd != -1) { unsigned char buf[4096]; int ret = pmtDemux->Read(buf, 4095, 10); - if (ret > 0) { + if (ret > 0) { #if HAVE_TRIPLEDRAGON - pmt_stop_update_filter(&pmt_update_fd); + pmt_stop_update_filter(&pmt_update_fd); #endif - printf("[zapit] pmt updated, sid 0x%x new version 0x%x\n", (buf[3] << 8) + buf[4], (buf[5] >> 1) & 0x1F); - zapit(g_current_channel->getChannelID(), current_is_nvod, true); + printf("[zapit] pmt updated, sid 0x%x new version 0x%x\n", (buf[3] << 8) + buf[4], (buf[5] >> 1) & 0x1F); + if(g_current_channel) { + int vpid = g_current_channel->getVideoPid(); + parse_pmt(g_current_channel); + if(vpid != g_current_channel->getVideoPid()) { + zapit(g_current_channel->getChannelID(), current_is_nvod, true); + } else { + if(event_mode) { + t_channel_id channel_id = g_current_channel->getChannelID(); + eventServer->sendEvent(CZapitClient::EVT_PMT_CHANGED, CEventServer::INITID_ZAPIT, &channel_id, sizeof(channel_id)); + } + start_camd(true); + pmt_set_update_filter(g_current_channel, &pmt_update_fd); + } + } + } } - } - /* yuck, don't waste that much cpu time :) */ usleep(0); #if 0