commit 3a4b9c5d76cfc42ab45170a96ce4f4192a2a9758
Author: David Matthews <dm@prolingua.co.uk>
Date: Sat Aug 13 16:02:32 2011 +0100
Fix problem with MHEG in recordings.
Now uses the sourceid rather than cardid when looking up channel
entries. If the look-up does not work properly BBC recordings may
pop up periodic messages about service errors.
diff --git a/mythtv/libs/libmythtv/interactivetv.cpp b/mythtv/libs/libmythtv/interactivetv.cpp
index d7a48a8..2cdbea0 100644
|
a
|
b
|
InteractiveTV::~InteractiveTV()
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Start or restart the MHEG engine. |
| 36 | | void InteractiveTV::Restart(uint chanid, uint cardid, bool isLive) |
| | 36 | void InteractiveTV::Restart(uint chanid, uint sourceid, bool isLive) |
| 37 | 37 | { |
| 38 | | m_context->Restart(chanid, cardid, isLive); |
| | 38 | m_context->Restart(chanid, sourceid, isLive); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // Called by the video player to see if the image needs to be updated |
diff --git a/mythtv/libs/libmythtv/interactivetv.h b/mythtv/libs/libmythtv/interactivetv.h
index 0739390..c8e00e6 100644
|
a
|
b
|
class InteractiveTV
|
| 17 | 17 | InteractiveTV(MythPlayer *nvp); |
| 18 | 18 | virtual ~InteractiveTV(); |
| 19 | 19 | |
| 20 | | void Restart(uint chanid, uint cardid, bool isLive); |
| | 20 | void Restart(uint chanid, uint sourceid, bool isLive); |
| 21 | 21 | // Process an incoming DSMCC packet. |
| 22 | 22 | void ProcessDSMCCSection(unsigned char *data, int length, |
| 23 | 23 | int componentTag, unsigned carouselId, |
diff --git a/mythtv/libs/libmythtv/mhi.cpp b/mythtv/libs/libmythtv/mhi.cpp
index f4777c7..1631495 100644
|
a
|
b
|
MHIContext::MHIContext(InteractiveTV *parent)
|
| 56 | 56 | m_updated(false), |
| 57 | 57 | m_displayWidth(StdDisplayWidth), m_displayHeight(StdDisplayHeight), |
| 58 | 58 | m_face_loaded(false), m_engineThread(NULL), m_currentChannel(-1), |
| 59 | | m_currentStream(-1), m_isLive(false), m_currentCard(0), |
| | 59 | m_currentStream(-1), m_isLive(false), m_currentSource(-1), |
| 60 | 60 | m_audioTag(-1), m_videoTag(-1), |
| 61 | 61 | m_lastNbiVersion(NBI_VERSION_UNSET), |
| 62 | 62 | m_videoRect(0, 0, StdDisplayWidth, StdDisplayHeight), |
| … |
… |
void MHIContext::StopEngine(void)
|
| 156 | 156 | |
| 157 | 157 | |
| 158 | 158 | // Start or restart the MHEG engine. |
| 159 | | void MHIContext::Restart(uint chanid, uint cardid, bool isLive) |
| | 159 | void MHIContext::Restart(uint chanid, uint sourceid, bool isLive) |
| 160 | 160 | { |
| 161 | 161 | int tuneinfo = m_tuneinfo.isEmpty() ? 0 : m_tuneinfo.takeFirst(); |
| 162 | 162 | |
| 163 | | LOG(VB_MHEG, LOG_INFO, QString("[mhi] Restart ch=%1 card=%2 live=%3 tuneinfo=0x%4") |
| 164 | | .arg((int)chanid).arg((int)cardid).arg(isLive).arg(tuneinfo,0,16)); |
| | 163 | LOG(VB_MHEG, LOG_INFO, QString("[mhi] Restart ch=%1 source=%2 live=%3 tuneinfo=0x%4") |
| | 164 | .arg((int)chanid).arg((int)sourceid).arg(isLive).arg(tuneinfo,0,16)); |
| 165 | 165 | |
| 166 | | m_currentCard = cardid; |
| | 166 | m_currentSource = sourceid; |
| 167 | 167 | m_currentStream = (chanid) ? (int)chanid : -1; |
| 168 | 168 | if (!(tuneinfo & kTuneKeepChnl)) |
| 169 | 169 | m_currentChannel = m_currentStream; |
| … |
… |
int MHIContext::GetChannelIndex(const QString &str)
|
| 650 | 650 | int serviceID = list[2].toInt(&ok, 16); |
| 651 | 651 | if (!ok) |
| 652 | 652 | break; |
| 653 | | // We only return channels that match the current capture card. |
| | 653 | // We only return channels that match the current capture source. |
| 654 | 654 | if (list[1].isEmpty()) // TransportID is not specified |
| 655 | 655 | { |
| 656 | 656 | query.prepare( |
| 657 | 657 | "SELECT chanid " |
| 658 | | "FROM channel, dtv_multiplex, cardinput, capturecard " |
| | 658 | "FROM channel, dtv_multiplex " |
| 659 | 659 | "WHERE networkid = :NETID AND" |
| 660 | 660 | " channel.mplexid = dtv_multiplex.mplexid AND " |
| 661 | 661 | " serviceid = :SERVICEID AND " |
| 662 | | " channel.sourceid = cardinput.sourceid AND " |
| 663 | | " cardinput.cardid = capturecard.cardid AND " |
| 664 | | " cardinput.cardid = :CARDID"); |
| | 662 | " channel.sourceid = :SOURCEID"); |
| 665 | 663 | } |
| 666 | 664 | else |
| 667 | 665 | { |
| … |
… |
int MHIContext::GetChannelIndex(const QString &str)
|
| 670 | 668 | break; |
| 671 | 669 | query.prepare( |
| 672 | 670 | "SELECT chanid " |
| 673 | | "FROM channel, dtv_multiplex, cardinput, capturecard " |
| | 671 | "FROM channel, dtv_multiplex " |
| 674 | 672 | "WHERE networkid = :NETID AND" |
| 675 | 673 | " channel.mplexid = dtv_multiplex.mplexid AND " |
| 676 | 674 | " serviceid = :SERVICEID AND " |
| 677 | 675 | " transportid = :TRANSID AND " |
| 678 | | " channel.sourceid = cardinput.sourceid AND " |
| 679 | | " cardinput.cardid = capturecard.cardid AND " |
| 680 | | " cardinput.cardid = :CARDID"); |
| | 676 | " channel.sourceid = :SOURCEID"); |
| 681 | 677 | query.bindValue(":TRANSID", transportID); |
| 682 | 678 | } |
| 683 | 679 | query.bindValue(":NETID", netID); |
| 684 | 680 | query.bindValue(":SERVICEID", serviceID); |
| 685 | | query.bindValue(":CARDID", m_currentCard); |
| | 681 | query.bindValue(":SOURCEID", m_currentSource); |
| 686 | 682 | if (query.exec() && query.isActive() && query.next()) |
| 687 | 683 | nResult = query.value(0).toInt(); |
| 688 | 684 | } |
| … |
… |
int MHIContext::GetChannelIndex(const QString &str)
|
| 695 | 691 | break; |
| 696 | 692 | MSqlQuery query(MSqlQuery::InitCon()); |
| 697 | 693 | query.prepare("SELECT chanid " |
| 698 | | "FROM channel, cardinput, capturecard " |
| | 694 | "FROM channel " |
| 699 | 695 | "WHERE channum = :CHAN AND " |
| 700 | | " channel.sourceid = cardinput.sourceid AND " |
| 701 | | " cardinput.cardid = capturecard.cardid AND " |
| 702 | | " cardinput.cardid = :CARDID"); |
| | 696 | " channel.sourceid = :SOURCEID"); |
| 703 | 697 | query.bindValue(":CHAN", channelNo); |
| 704 | | query.bindValue(":CARDID", m_currentCard); |
| | 698 | query.bindValue(":SOURCEID", m_currentSource); |
| 705 | 699 | if (query.exec() && query.isActive() && query.next()) |
| 706 | 700 | nResult = query.value(0).toInt(); |
| 707 | 701 | } |
diff --git a/mythtv/libs/libmythtv/mhi.h b/mythtv/libs/libmythtv/mhi.h
index 0071c4c..2b10c8b 100644
|
a
|
b
|
class MHIContext : public MHContext, public QRunnable
|
| 50 | 50 | // A NetworkBootInfo sub-descriptor is present in the PMT. |
| 51 | 51 | void SetNetBootInfo(const unsigned char *data, uint length); |
| 52 | 52 | /// Restart the MHEG engine. |
| 53 | | void Restart(uint chanid, uint cardid, bool isLive); |
| | 53 | void Restart(uint chanid, uint sourceid, bool isLive); |
| 54 | 54 | // Offer a key press. Returns true if it accepts it. |
| 55 | 55 | // This will depend on the current profile. |
| 56 | 56 | bool OfferKey(QString key); |
| … |
… |
class MHIContext : public MHContext, public QRunnable
|
| 176 | 176 | int m_currentChannel; |
| 177 | 177 | int m_currentStream; |
| 178 | 178 | bool m_isLive; |
| 179 | | int m_currentCard; |
| | 179 | int m_currentSource; |
| 180 | 180 | |
| 181 | 181 | int m_audioTag; |
| 182 | 182 | int m_videoTag; |
diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
index 623a6a8..7ab94da 100644
|
a
|
b
|
void TV::UnpauseLiveTV(PlayerContext *ctx, bool bQuietly /*=false*/)
|
| 11326 | 11326 | */ |
| 11327 | 11327 | void TV::ITVRestart(PlayerContext *ctx, bool isLive) |
| 11328 | 11328 | { |
| 11329 | | uint chanid = 0; |
| 11330 | | uint cardid = 0; |
| | 11329 | uint chanid = -1; |
| | 11330 | uint sourceid = -1; |
| 11331 | 11331 | |
| 11332 | 11332 | if (ContextIsPaused(ctx, __FILE__, __LINE__)) |
| 11333 | 11333 | return; |
| 11334 | 11334 | |
| 11335 | 11335 | ctx->LockPlayingInfo(__FILE__, __LINE__); |
| 11336 | 11336 | if (ctx->playingInfo) |
| | 11337 | { |
| 11337 | 11338 | chanid = ctx->playingInfo->GetChanID(); |
| | 11339 | sourceid = ChannelUtil::GetSourceIDForChannel(chanid); |
| | 11340 | } |
| 11338 | 11341 | ctx->UnlockPlayingInfo(__FILE__, __LINE__); |
| 11339 | 11342 | |
| 11340 | | cardid = ctx->GetCardID(); |
| 11341 | | |
| 11342 | 11343 | ctx->LockDeletePlayer(__FILE__, __LINE__); |
| 11343 | 11344 | if (ctx->player) |
| 11344 | | ctx->player->ITVRestart(chanid, cardid, isLive); |
| | 11345 | ctx->player->ITVRestart(chanid, sourceid, isLive); |
| 11345 | 11346 | ctx->UnlockDeletePlayer(__FILE__, __LINE__); |
| 11346 | 11347 | } |
| 11347 | 11348 | |