KODI(xbmc)播放器创建流程

CGUIWindowManager::OnAction(const CAction &action) const

{HandleAction(action);}

CGUIWindowManager::HandleAction(CAction const& action) const

{CGUIWindow* window = GetWindow(GetActiveWindow());
  if (window)
    return window->OnAction(action);}

CGUIWindow

{// OnAction() is called by our window manager.  We should process any messages
  // that should be handled at the window level in the derived classes, and any
  // unhandled messages should be dropped through to here where we send the message
  // on to the currently focused control.  Returns true if the action has been handled
  // and does not need to be passed further down the line (to our global action handlers)}

CGUIWindowVideoBase:CGUIMediaWindow:CGUIWindow

CGUIWindowVideoBase::PlayItem(int iItem, const std::string &player)

{CServiceBroker::GetPlaylistPlayer().ClearPlaylist(PLAYLIST_VIDEO);
    CServiceBroker::GetPlaylistPlayer().Reset();
    CServiceBroker::GetPlaylistPlayer().Add(PLAYLIST_VIDEO, queuedItems);
    CServiceBroker::GetPlaylistPlayer().SetCurrentPlaylist(PLAYLIST_VIDEO);
    CServiceBroker::GetPlaylistPlayer().Play();}

CGUIWindowVideoBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)

{OnPlayMedia(itemNumber);}

CGUIWindowVideoBase::OnPlayMedia(int iItem, const std::string &player)  override CGUIMediaWindow

{PlayMovie(&item, player);}

CGUIWindowVideoBase::PlayMovie(const CFileItem *item, const std::string &player)

{CServiceBroker::GetPlaylistPlayer().Play(std::make_shared<CFileItem>(*item), player);}

CPlayListPlayer::Play(const CFileItemPtr &pItem, std::string player)

{g_application.PlayFile(*item, player, bAutoPlay);}

PLAYLIST::CPlayListPlayer &CServiceBroker::GetPlaylistPlayer()
{
  return g_application.m_ServiceManager->GetPlaylistPlayer();
}

CServiceManager

{std::unique_ptr<PLAYLIST::CPlayListPlayer> m_playlistPlayer;}

CApplication

{std::unique_ptr<CServiceManager> m_ServiceManager;}

CApplication::Create(const CAppParamParser &params)

{m_ServiceManager.reset(new CServiceManager());

m_ServiceManager->InitStageOne()}

CServiceManager::InitStageOne()

{m_playlistPlayer.reset(new PLAYLIST::CPlayListPlayer());}

 

CApplication

{CApplicationPlayer m_appPlayer;}

CApplication::PlayFile(CFileItem item, const std::string& player, bool bRestart)

{m_appPlayer.OpenFile(item, options, m_ServiceManager->GetPlayerCoreFactory(), player, *this);}

CApplicationPlayer::OpenFile(const CFileItem& item, const CPlayerOptions& options,
                                  const CPlayerCoreFactory &factory,
                                  const std::string &playerName, IPlayerCallback& callback) //callback is CApplication

{player = CreatePlayer(factory, newPlayer, callback);

player->OpenFile(item, options);

}

CApplicationPlayer::CreatePlayer(const CPlayerCoreFactory &factory, const std::string &player, IPlayerCallback& callback)

{m_pPlayer.reset(factory.CreatePlayer(player, callback));}

CApplicationPlayer

{std::shared_ptr<IPlayer> m_pPlayer;}

IPlayer* CPlayerCoreFactory::CreatePlayer(const std::string& nameId, IPlayerCallback& callback) const

{return m_vecPlayerConfigs[idx]->CreatePlayer(callback);}

CPlayerCoreConfig

{IPlayer* CreatePlayer(IPlayerCallback& callback) const

{pPlayer = new CVideoPlayer(callback);}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值