Ticket #9868: mythlive.patch

File mythlive.patch, 4.1 KB (added by Ian Dall <ian@…>, 9 years ago)

Patch to handle death of an embedded player.

  • mythtv/libs/libmythtv/tv_play.cpp

    diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
    index 768a829..23417b6 100644
    a b  
    55#include <unistd.h>
    66#include <stdint.h>
    77#include <pthread.h>
     8#include <sstream>
    89
    910#include <algorithm>
    1011using namespace std;
    bool TV::Init(bool createWindow) 
    11311132
    11321133TV::~TV(void)
    11331134{
    1134     LOG(VB_PLAYBACK, LOG_INFO, "TV::~TV() -- begin");
     1135    std::stringstream ss;
     1136    ss << "TV::~TV(" << hex << this << ") -- begin";
     1137    LOG(VB_PLAYBACK, LOG_INFO, ss.str().c_str());
     1138
     1139    emit PlayerDied();
    11351140
    11361141    if (browsehelper)
    11371142        browsehelper->Stop();
    TV::~TV(void) 
    11961201    }
    11971202    ReturnPlayerLock(mctx);
    11981203
    1199     LOG(VB_PLAYBACK, LOG_INFO, "TV::~TV() -- end");
     1204    ss << "TV::~TV(" << hex << this << ") -- end";
     1205    LOG(VB_PLAYBACK, LOG_INFO, ss.str().c_str());
    12001206}
    12011207
    12021208/**
  • mythtv/libs/libmythtv/tv_play.h

    diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h
    index e8f90e7..05d8bb2 100644
    a b class MTV_PUBLIC TV : public QObject 
    263263    void HandleOSDClosed(int osdType);
    264264    void timerEvent(QTimerEvent*);
    265265
     266  signals:
     267    void PlayerDied();
     268
    266269  protected:
    267270    void OSDDialogEvent(int result, QString text, QString action);
    268271
  • mythtv/programs/mythfrontend/guidegrid.cpp

    diff --git a/mythtv/programs/mythfrontend/guidegrid.cpp b/mythtv/programs/mythfrontend/guidegrid.cpp
    index f6ba87b..931b432 100644
    a b  
    55#include <math.h>
    66#include <unistd.h>
    77#include <iostream>
     8#include <sstream>
    89#include <algorithm>
    910using namespace std;
    1011
    void GuideGrid::RunProgramGuide(uint chanid, const QString &channum, 
    217218        delete gg;
    218219}
    219220
     221void GuideGrid::playerDeath(void)
     222{
     223        std::stringstream ss;
     224        ss << "GuideGrid::playerDeath (m_player = " << hex << m_player << ")";
     225        LOG(VB_PLAYBACK, LOG_INFO, ss.str().c_str());
     226        m_player = NULL;
     227}
     228
    220229GuideGrid::GuideGrid(MythScreenStack *parent,
    221230                     uint chanid, QString channum,
    222231                     TV *player, bool embedVideo,
    GuideGrid::GuideGrid(MythScreenStack *parent, 
    262271    m_currentStartTime = m_originalStartTime.addSecs(secsoffset);
    263272    m_startChanID  = chanid;
    264273    m_startChanNum = channum;
     274    connect (m_player, SIGNAL(PlayerDied()), this, SLOT(playerDeath()));
    265275}
    266276
    267277bool GuideGrid::Create()
    void GuideGrid::updateChannels(void) 
    14661476    PixmapChannel *chinfo = GetChannelInfo(m_currentStartChannel);
    14671477
    14681478    if (m_player)
    1469         m_player->ClearTunableCache();
     1479    {
     1480        std::stringstream ss;
     1481        ss << "TV::ClearTunableCache (m_player = " << hex << m_player << ")";
     1482        LOG(VB_PLAYBACK, LOG_INFO, ss.str().c_str());
     1483        m_player->ClearTunableCache();
     1484    }
    14701485
    14711486    for (unsigned int y = 0; (y < (unsigned int)m_channelCount) && chinfo; ++y)
    14721487    {
    void GuideGrid::updateChannels(void) 
    14821497
    14831498        if (m_player)
    14841499        {
     1500                std::stringstream ss;
     1501                ss << "TV::GetPlayerReadLock (m_player = " << hex << m_player << ")";
     1502            LOG(VB_PLAYBACK, LOG_INFO, ss.str().c_str());
     1503
    14851504            const PlayerContext *ctx = m_player->GetPlayerReadLock(
    14861505                -1, __FILE__, __LINE__);
    14871506            if (ctx && chinfo)
    void GuideGrid::updateChannels(void) 
    15251544        InfoMap infomap;
    15261545        chinfo->ToMap(infomap);
    15271546        item->SetTextFromMap(infomap);
    1528        
     1547
    15291548        if (chinfo && !chinfo->icon.isEmpty())
    15301549        {
    15311550            if (chinfo->CacheChannelIcon())
  • mythtv/programs/mythfrontend/guidegrid.h

    diff --git a/mythtv/programs/mythfrontend/guidegrid.h b/mythtv/programs/mythfrontend/guidegrid.h
    index 541043e..c3ac54b 100644
    a b class GuideGrid : public ScheduleCommon, public JumpToChannelListener 
    130130
    131131    void Close();
    132132    void customEvent(QEvent *event);
     133    void playerDeath();
    133134
    134135  protected:
    135136    GuideGrid(MythScreenStack *parentStack,